-
-
Notifications
You must be signed in to change notification settings - Fork 673
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixes user defined aliases being overridden by OMB #305
Conversation
|
My bad. I'll add more information to the PR in a few seconds.
I personally happened to define my aliases before sourcing OMB, which is why I opened the issue & pr. But, I don't think that OMB should be overwriting these aliases, especially with how it's currently done. (Transparently to the user)
I would agree, that the aliases in the other transparent components of OMB should also have checks, to prevent from overwriting user aliases without the user explicitly wanting it.
Yes, definitely. |
Updated PR description to contain more information |
Further, should the aliases in the grep.sh, directories.sh, and bourne-shell.sh not be moved into the aliases folder, so that the user can explicitly enable/disable them? That seems much more reasonable to me, as I don't believe these aliases are actually used anywhere in OMB components. |
Thank you for updating the description. Additionally, you may edit the PR title.
It's a very fair argument.
Yeah, I agree. I also think we should clean up these things. One thing that I'm not sure of is whether we can introduce such breaking changes without notice. I guess there are a few hundred thousand users of OMB (at least, there were about twenty thousand clones by ten thousand unique cloners in the last two weeks), and I guess most of them are using OMB with the default configuration plus a theme. I doubt most of them actually check what aliases are defined in each |
Yes, the breaking change is my one concern. |
Also, I am converting the PR to a draft until we decide which option to go with. |
Thank you for the reply. It's actually hard for me to judge whether we can break the existing behavior.
Can you describe it in more detail? Is it the same environment variable as the one mentioned in the cover (as quoted below)?
My current consideration is this: For example, if that variable contains the value Or maybe you are thinking of introducing a variable to control the aliases defined in |
Yes, that is what I meant. An environment variable like
That is what I was thinking, although it would not control any aliases in Also, |
I thought, ideally, it'd be better if we could finally reorganize things in
Yes, though maybe it depends on the choice of the variable name. We have been defining variable names like |
Can I take over this PR and implement the suggested configuration variable (say, |
Of course! I don't mind at all if you take over this & PR it, as I haven't been working on it at all in quite a while |
Thank you for your response! I'll later work on it when I have time! |
) Fixes ohmybash#304 by checking if the alias already exists before applying it.
I've implemented |
@solonovamax I've merged the PR. Thank you for raising the issue and attempting to solve the issue! |
Fixes #304.
Currenty, oh-my-bash currently overrides any aliases that has been set for
ls
,grep
,egrep
, andfgrep
, if the file/usr/bin/dircolors
exists.This means if a user specifies any aliases before OMB is sourced, they will be overwritten in a manner which is non transparent to the user (It is not stated anywhere, and the user cannot explicitly disabled it).
The goal of this PR is to not overwrite the aliases if they already exist, preferring the pre-defined aliases instead.
Alternatively, a means of disabling the new OMB aliases could be introduced through an environment variable, to allow the user to not have them set.
Currently, it wraps each alias call in an
if
statement, to check if they exist prior to applying them.But, as per suggestions from akinomyoga, a function shall be introduced to streamline this process, in addition to refactors to all the other aliases which are defined by OMB that are not in the aliases folder or the plugins folder.