Closed GiselleSerate closed 6 years ago
Create a temp file, pipe in the output from the alias
command and grep through it for alias \""$1"
at the beginning of each line?
I reverse engineered this basically xD thanks though, useful suggestions
Most relevantly: what should the behavior be in this edge case? Should we:
Since this command is all about convenience, I would have it override the old alias and not reject the new command. I would also check the generated file and delete if necessary. I'm also generally a fan of doing things silently, but we could echo out a statement telling the user that their old alias has been overridden if you want. However, if you do that, you might only want to do it when it's from our generated file so that we can stay true to the original behavior of alias
in case any other programs assume that it won't print anything.
Oooh, that sounds like a great way to handle it. Currently I have it failing verbosely, but that shouldn't be terrible to implement. (side note for future me: will involve grep, probably, and a little bit of ed. and much regex.)
Currently deletes the old alias silently from .usr_aliases
and does nothing otherwise.
This seems to work for for all cases quite well; I'd probably only be worried about order if they try to override a name that someone is already using. Because then inclusion in how things get called from the .bashrc
matters a lot as far as what actually gets defined.
This happens when I leave projects for a long time; I forget why I haven't closed issues. I'm going to close this, because my previous comments sound pretty resolvey to me?
It's easy for the aliases in the file we wrote. What about other aliases? I think the alias command would be helpful here, but parsing might be sketchy.