shell-completion: systemctl set-default,get-default,is-system-running

This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2014-10-27 21:34:28 -05:00
parent 7c67f0f71a
commit 1cf3c30c07
3 changed files with 19 additions and 6 deletions

6
TODO
View File

@ -792,8 +792,10 @@ External:
* register catalog database signature as file magic * register catalog database signature as file magic
* zsh shell completion: <command> <verb> -<TAB> should complete options, but currently * zsh shell completion:
does not - <command> <verb> -<TAB> should complete options, but currently does not
- systemctl add-wants,add-requires
Regularly: Regularly:

View File

@ -148,7 +148,8 @@ _systemctl () {
[STANDALONE]='daemon-reexec daemon-reload default [STANDALONE]='daemon-reexec daemon-reload default
emergency exit halt hibernate hybrid-sleep kexec list-jobs emergency exit halt hibernate hybrid-sleep kexec list-jobs
list-sockets list-timers list-units list-unit-files poweroff list-sockets list-timers list-units list-unit-files poweroff
reboot rescue show-environment suspend get-default' reboot rescue show-environment suspend get-default
is-system-running'
[NAME]='snapshot' [NAME]='snapshot'
[FILE]='link' [FILE]='link'
[TARGETS]='set-default' [TARGETS]='set-default'

View File

@ -31,6 +31,9 @@
"disable:Disable one or more unit files" "disable:Disable one or more unit files"
"reenable:Reenable one or more unit files" "reenable:Reenable one or more unit files"
"preset:Enable/disable one or more unit files based on preset configuration" "preset:Enable/disable one or more unit files based on preset configuration"
"set-default:Set the default target"
"get-default:Query the default target"
"is-system-running:Query overall status of the system"
"help:Show documentation for specified units" "help:Show documentation for specified units"
"list-dependencies:Show unit dependency tree" "list-dependencies:Show unit dependency tree"
"mask:Mask one or more units" "mask:Mask one or more units"
@ -237,21 +240,28 @@ done
(( $+functions[_systemctl_unmask] )) || _systemctl_unmask() (( $+functions[_systemctl_unmask] )) || _systemctl_unmask()
{ {
_systemctl_masked_units _systemctl_masked_units
compadd "$@" -a - _sys_masked_units || _message "no masked unit found" compadd "$@" -a - _sys_masked_units || _message "no masked units found"
} }
# Completion functions for JOBS # Completion functions for JOBS
(( $+functions[_systemctl_cancel] )) || _systemctl_cancel() (( $+functions[_systemctl_cancel] )) || _systemctl_cancel()
{ {
compadd "$@" - $(__systemctl list-jobs \ compadd "$@" - $(__systemctl list-jobs \
| cut -d' ' -f1 2>/dev/null ) || _message "no job found" | cut -d' ' -f1 2>/dev/null ) || _message "no jobs found"
} }
# Completion functions for SNAPSHOTS # Completion functions for SNAPSHOTS
(( $+functions[_systemctl_delete] )) || _systemctl_delete() (( $+functions[_systemctl_delete] )) || _systemctl_delete()
{ {
compadd "$@" - $(__systemctl list-units --type snapshot --all \ compadd "$@" - $(__systemctl list-units --type snapshot --all \
| cut -d' ' -f1 2>/dev/null ) || _message "no snapshot found" | cut -d' ' -f1 2>/dev/null ) || _message "no snapshots found"
}
# Completion functions for TARGETS
(( $+functions[_systemctl_set-default] )) || _systemctl_set-default()
{
compadd "$@" - $(__systemctl list-unit-files --type target --all \
| cut -d' ' -f1 2>/dev/null ) || _message "no targets found"
} }
# Completion functions for ENVS # Completion functions for ENVS