[Bash-completion-devel] A question about 9af6f3504e8c94e5ead187b7cd223bd481548957
Igor Murzov
e-mail at date.by
Sun Apr 17 22:28:47 UTC 2011
Hi, list.
Can someone throw a light on why changing
have && { ... }
to
have || return { ... }
is a good idea? It is not clear how to return from script with multiple
functions. For example in completions/xz I see following:
---------------------------------------------
have xz || have pxz || return
_xz()
{
...
} && complete -F _xz xz pxz
have xzdec &&
_xzdec()
{
...
} && complete -F _xzdec xzdec
---------------------------------------------
If there is no xz in the system, but xzdec is there, then both functions will
not be loaded. May be the better way is to place all names to the first check
and left everything else unchanged like this:
---------------------------------------------
have xz || have pxz || have xzdec || return
have xz || have pxz && _xz()
{
...
} && complete -F _xz xz pxz
have xzdec &&
_xzdec()
{
...
} && complete -F _xzdec xzdec
---------------------------------------------
This way I think it will be more correct and still fast if no appropriate
utilites found. But this way to my mind it's somewhat hard to maintain all
these scripts.
-- Igor
More information about the Bash-completion-devel
mailing list