Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Best practices for managing aliases in ohmyzsh?
On Tue, Aug 31, 2021 at 11:23 PM Steve Dondley <s@xxxxxxxxxxx> wrote:
>
> So to sum up, it sounds like your advice is "Always use a script instead
> of a function. If the script can't work for whatever reason, then use a
> function."
Close enough.
> To keep things organized, I think I set up a subdirectory called
> ~/bin/shell_alias_scripts, add it to $PATH and toss all the scripts that
> are used by aliases in there. And so long as I only call these scripts
> with an alias, there shouldn't be any performance penalty because they
> won't all have to be sourced by zsh.
If you only intend to invoke these scripts via aliases and never
directly from interactive shells or from other scripts, then you don't
need to put them in PATH. You can invoke them via their full names
instead.
alias foo='~/.local/libexec/bar -blah'
~/.local/libexec would be your local equivalent of /usr/libexec, which
contains a bunch of executable files that aren't meant to be in PATH.
If you do intend to invoke these scripts either from interactive
shells or from other scripts, your plan is fine, although I would just
put all these scripts in ~/bin.
Roman.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author