mirror of
https://github.com/systemd/systemd
synced 2024-07-21 02:05:05 +00:00
shell-completion: add new systemd-id128 options
This commit is contained in:
parent
a50666e376
commit
45a3c02564
|
@ -28,12 +28,13 @@ _systemd_id128() {
|
||||||
local i verb comps
|
local i verb comps
|
||||||
local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]} words cword
|
local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]} words cword
|
||||||
local -A OPTS=(
|
local -A OPTS=(
|
||||||
[STANDALONE]='-h --help --version -p --pretty'
|
[STANDALONE]='-h --help --version -p --pretty --value -u --uuid --no-legend --no-pager -j'
|
||||||
[ARG]='-a --app-specific'
|
[ARG]='-a --app-specific --json'
|
||||||
)
|
)
|
||||||
|
|
||||||
local -A VERBS=(
|
local -A VERBS=(
|
||||||
[STANDALONE]='new machine-id boot-id invocation-id help'
|
[STANDALONE]='new machine-id boot-id invocation-id help'
|
||||||
|
[ARG]='show'
|
||||||
)
|
)
|
||||||
|
|
||||||
_init_completion || return
|
_init_completion || return
|
||||||
|
@ -43,6 +44,9 @@ _systemd_id128() {
|
||||||
--app-specific|-a)
|
--app-specific|-a)
|
||||||
comps=""
|
comps=""
|
||||||
;;
|
;;
|
||||||
|
--json)
|
||||||
|
comps="short pretty off"
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
COMPREPLY=( $(compgen -W '$comps' -- "$cur") )
|
COMPREPLY=( $(compgen -W '$comps' -- "$cur") )
|
||||||
return 0
|
return 0
|
||||||
|
@ -65,6 +69,12 @@ _systemd_id128() {
|
||||||
comps=${VERBS[*]}
|
comps=${VERBS[*]}
|
||||||
elif __contains_word "$verb" ${VERBS[STANDALONE]}; then
|
elif __contains_word "$verb" ${VERBS[STANDALONE]}; then
|
||||||
comps=''
|
comps=''
|
||||||
|
elif __contains_word "$verb" ${VERBS[ARG]}; then
|
||||||
|
case $verb in
|
||||||
|
show)
|
||||||
|
comps="$(IFS='\n ' systemd-id128 show --no-legend)"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
fi
|
fi
|
||||||
|
|
||||||
COMPREPLY=( $(compgen -W '$comps' -- "$cur") )
|
COMPREPLY=( $(compgen -W '$comps' -- "$cur") )
|
||||||
|
|
Loading…
Reference in a new issue