chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
4a3e79e
)
shell-completion/bash: add add-wants and add-requires
author
Lukas Nykryn
<lnykryn@redhat.com>
Thu, 16 Oct 2014 07:41:02 +0000
(09:41 +0200)
committer
Lukas Nykryn
<lnykryn@redhat.com>
Sun, 19 Oct 2014 16:20:06 +0000
(18:20 +0200)
shell-completion/bash/systemctl.in
patch
|
blob
|
history
diff --git
a/shell-completion/bash/systemctl.in
b/shell-completion/bash/systemctl.in
index afa80dad727178ab78c220d8700937957b0becfa..8c1ecd486eee0733f9632358aee9008f0f02cfff 100644
(file)
--- a/
shell-completion/bash/systemctl.in
+++ b/
shell-completion/bash/systemctl.in
@@
-74,6
+74,7
@@
__get_disabled_units () { __systemctl $1 list-unit-files \
| { while read -r a b c ; do [[ $b == "disabled" ]] && echo " $a"; done; }; }
__get_masked_units () { __systemctl $1 list-unit-files \
| { while read -r a b c ; do [[ $b == "masked" ]] && echo " $a"; done; }; }
| { while read -r a b c ; do [[ $b == "disabled" ]] && echo " $a"; done; }; }
__get_masked_units () { __systemctl $1 list-unit-files \
| { while read -r a b c ; do [[ $b == "masked" ]] && echo " $a"; done; }; }
+__get_all_unit_files () { { __systemctl $1 list-unit-files; } | { while read -r a b; do echo " $a"; done; }; }
_systemctl () {
local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]}
_systemctl () {
local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]}
@@
-139,6
+140,7
@@
_systemctl () {
[ISOLATABLE_UNITS]='isolate'
[RELOADABLE_UNITS]='reload condreload reload-or-try-restart force-reload'
[RESTARTABLE_UNITS]='restart reload-or-restart'
[ISOLATABLE_UNITS]='isolate'
[RELOADABLE_UNITS]='reload condreload reload-or-try-restart force-reload'
[RESTARTABLE_UNITS]='restart reload-or-restart'
+ [TARGET_AND_UNITS]='add-wants add-requires'
[MASKED_UNITS]='unmask'
[JOBS]='cancel'
[SNAPSHOTS]='delete'
[MASKED_UNITS]='unmask'
[JOBS]='cancel'
[SNAPSHOTS]='delete'
@@
-217,6
+219,16
@@
_systemctl () {
comps=$( __get_masked_units $mode )
compopt -o filenames
comps=$( __get_masked_units $mode )
compopt -o filenames
+ elif __contains_word "$verb" ${VERBS[TARGET_AND_UNITS]}; then
+ if __contains_word "$prev" ${VERBS[TARGET_AND_UNITS]} \
+ || __contains_word "$prev" ${OPTS[STANDALONE]}; then
+ comps=$( __systemctl $mode list-unit-files --type target --all \
+ | { while read -r a b; do echo " $a"; done; } )
+ else
+ comps=$( __get_all_unit_files $mode )
+ fi
+ compopt -o filenames
+
elif __contains_word "$verb" ${VERBS[STANDALONE]} ${VERBS[NAME]}; then
comps=''
elif __contains_word "$verb" ${VERBS[STANDALONE]} ${VERBS[NAME]}; then
comps=''