bash: execute --long-options only when needed

Delay the execution of $tool --long-options only when really using its
output.
This commit is contained in:
Pino Toscano
2014-11-25 18:15:37 +01:00
parent b00adf3b78
commit 4b792354f0
5 changed files with 20 additions and 21 deletions

View File

@@ -35,8 +35,6 @@ _guestmount ()
_init_completion -s || return
longopts="$(guestmount --long-options)"
# See if user has specified certain options anywhere on the
# command line before the current word.
while [ $c -lt $COMP_CWORD ]; do
@@ -57,6 +55,7 @@ _guestmount ()
case "$cur" in
--*)
# --options
longopts="$(guestmount --long-options)"
COMPREPLY=( $(compgen -W "$longopts" -- "$cur") )
return ;;
*)