puppet: Parse most subcommand options from "help subcommand" output
This commit is contained in:
parent
f94d1a6803
commit
00a80a2a83
@ -45,6 +45,14 @@ _puppet_references()
|
|||||||
COMPREPLY+=( $( compgen -W "$puppet_doc_list" -- "$cur" ) )
|
COMPREPLY+=( $( compgen -W "$puppet_doc_list" -- "$cur" ) )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_puppet_subcmd_opts()
|
||||||
|
{
|
||||||
|
# puppet cmd help is somewhat slow, avoid if possible
|
||||||
|
[[ -z $cur || $cur == -* ]] && \
|
||||||
|
COMPREPLY+=( $( compgen -W \
|
||||||
|
'$( _parse_usage "$1" "help $2" )' -- "$cur" ) )
|
||||||
|
}
|
||||||
|
|
||||||
_puppet()
|
_puppet()
|
||||||
{
|
{
|
||||||
local cur prev words cword
|
local cur prev words cword
|
||||||
@ -130,10 +138,9 @@ _puppet()
|
|||||||
return 0
|
return 0
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
COMPREPLY=( $( compgen -W '--certname --daemonize --no-daemonize
|
_puppet_subcmd_opts "$1" $subcommand
|
||||||
--debug --detailed-exitcodes --digest --disable --enable --fingerprint
|
# _parse_usage doesn't grok [-D|--daemonize|--no-daemonize]
|
||||||
--help --logdest --masterport --no-client --noop --onetime --test
|
COMPREPLY+=( $( compgen -W '--no-daemonize' -- "$cur" ) )
|
||||||
--verbose --version --waitforcert' -- "$cur" ) )
|
|
||||||
return 0
|
return 0
|
||||||
esac
|
esac
|
||||||
;;
|
;;
|
||||||
@ -153,9 +160,7 @@ _puppet()
|
|||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
if [[ "$cur" == -* ]]; then
|
if [[ "$cur" == -* ]]; then
|
||||||
COMPREPLY=( $( compgen -W '--debug --detailed-exitcodes --help
|
_puppet_subcmd_opts "$1" $subcommand
|
||||||
--loadclasses --logdest --noop --execute --test --verbose
|
|
||||||
--catalog --write-catalog-summary' -- "$cur" ) )
|
|
||||||
else
|
else
|
||||||
_filedir
|
_filedir
|
||||||
fi
|
fi
|
||||||
@ -199,7 +204,7 @@ _puppet()
|
|||||||
esac
|
esac
|
||||||
;;
|
;;
|
||||||
describe)
|
describe)
|
||||||
COMPREPLY=( $( compgen -W '--help --providers --list --meta --short' -- "$cur" ) )
|
_puppet_subcmd_opts "$1" $subcommand
|
||||||
if [[ "$cur" != -* ]]; then
|
if [[ "$cur" != -* ]]; then
|
||||||
_puppet_types
|
_puppet_types
|
||||||
fi
|
fi
|
||||||
@ -221,8 +226,7 @@ _puppet()
|
|||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
if [[ "$cur" == -* ]]; then
|
if [[ "$cur" == -* ]]; then
|
||||||
COMPREPLY=( $( compgen -W '--all --help --outputdir
|
_puppet_subcmd_opts "$1" $subcommand
|
||||||
--mode --reference --charset --list' -- "$cur" ) )
|
|
||||||
else
|
else
|
||||||
_filedir
|
_filedir
|
||||||
fi
|
fi
|
||||||
@ -241,9 +245,7 @@ _puppet()
|
|||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
if [[ "$cur" == -* ]]; then
|
if [[ "$cur" == -* ]]; then
|
||||||
COMPREPLY=( $( compgen -W '--help --version --debug
|
_puppet_subcmd_opts "$1" $subcommand
|
||||||
--verbose --local --remote --server --bucket' \
|
|
||||||
-- "$cur" ) )
|
|
||||||
else
|
else
|
||||||
COMPREPLY=( $( compgen -W 'backup get restore' \
|
COMPREPLY=( $( compgen -W 'backup get restore' \
|
||||||
-- "$cur" ) )
|
-- "$cur" ) )
|
||||||
@ -266,9 +268,7 @@ _puppet()
|
|||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
if [[ "$cur" == -* ]]; then
|
if [[ "$cur" == -* ]]; then
|
||||||
COMPREPLY=( $( compgen -W '--all --class --debug
|
_puppet_subcmd_opts "$1" $subcommand
|
||||||
--foreground --help --host --no-fqdn
|
|
||||||
--ignoreschedules --tag --test --ping' -- "$cur" ) )
|
|
||||||
else
|
else
|
||||||
_known_hosts_real "$cur"
|
_known_hosts_real "$cur"
|
||||||
fi
|
fi
|
||||||
@ -282,9 +282,9 @@ _puppet()
|
|||||||
return 0
|
return 0
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
COMPREPLY=( $( compgen -W '--daemonize --no-daemonize
|
_puppet_subcmd_opts "$1" $subcommand
|
||||||
--debug --help --logdest --verbose --version' \
|
# _parse_usage doesn't grok [-D|--daemonize|--no-daemonize]
|
||||||
-- "$cur" ) )
|
COMPREPLY+=( $( compgen -W '--no-daemonize' -- "$cur" ) )
|
||||||
return 0
|
return 0
|
||||||
esac
|
esac
|
||||||
;;
|
;;
|
||||||
@ -308,9 +308,7 @@ _puppet()
|
|||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
if [[ "$cur" == -* ]]; then
|
if [[ "$cur" == -* ]]; then
|
||||||
COMPREPLY=( $( compgen -W '--help --version --debug
|
_puppet_subcmd_opts "$1" $subcommand
|
||||||
--verbose --execute --detailed-exitcodes
|
|
||||||
--logdest' -- "$cur" ) )
|
|
||||||
else
|
else
|
||||||
_filedir
|
_filedir
|
||||||
fi
|
fi
|
||||||
@ -318,8 +316,7 @@ _puppet()
|
|||||||
esac
|
esac
|
||||||
;;
|
;;
|
||||||
resource|*)
|
resource|*)
|
||||||
COMPREPLY=( $( compgen -W '--help --version --debug --verbose' \
|
_puppet_subcmd_opts "$1" $subcommand
|
||||||
-- "$cur" ) )
|
|
||||||
return 0
|
return 0
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
Loading…
x
Reference in New Issue
Block a user