summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2015-09-05 12:25:52 +0200
committerLennart Poettering <lennart@poettering.net>2015-09-05 12:25:52 +0200
commit335250e7bdd09794f9a639c99fbd73b701b2d6e1 (patch)
tree6cbba2e6905425f151d75884ab8ce9cfa9f3e634
parent33ce5f6a0bf21ed74e33076f500db01a1520972a (diff)
parent3a221b5df8527aeb4fd9b7aa66b01971dc29acf6 (diff)
Merge pull request #1150 from evverx/update-systemctl-completion
shell-completion: update systemctl bash completion
-rw-r--r--shell-completion/bash/systemctl.in22
1 files changed, 20 insertions, 2 deletions
diff --git a/shell-completion/bash/systemctl.in b/shell-completion/bash/systemctl.in
index 21c79cae8e..4d63e2870f 100644
--- a/shell-completion/bash/systemctl.in
+++ b/shell-completion/bash/systemctl.in
@@ -85,6 +85,12 @@ __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; }; }
+__get_machines() {
+ local a b
+ (machinectl list-images --no-legend --no-pager; machinectl list --no-legend --no-pager) | \
+ { while read a b; do echo " $a"; done; } | sort -u;
+}
+
_systemctl () {
local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]}
local i verb comps mode
@@ -92,8 +98,10 @@ _systemctl () {
local -A OPTS=(
[STANDALONE]='--all -a --reverse --after --before --defaults --failed --force -f --full -l --global
--help -h --no-ask-password --no-block --no-legend --no-pager --no-reload --no-wall
- --quiet -q --privileged -P --system --user --version --runtime --recursive -r --firmware-setup'
- [ARG]='--host -H --kill-who --property -p --signal -s --type -t --state --job-mode --root'
+ --quiet -q --privileged -P --system --user --version --runtime --recursive -r --firmware-setup
+ --show-types -i --ignore-inhibitors --plain'
+ [ARG]='--host -H --kill-who --property -p --signal -s --type -t --state --job-mode --root
+ --preset-mode -n --lines -o --output -M --machine'
)
if __contains_word "--user" ${COMP_WORDS[*]}; then
@@ -132,6 +140,16 @@ _systemctl () {
--property|-p)
comps=$(__systemd_properties $mode)
;;
+ --preset-mode)
+ comps='full enable-only disable-only'
+ ;;
+ --output|-o)
+ comps='short short-iso short-precise short-monotonic verbose export json
+ json-pretty json-sse cat'
+ ;;
+ --machine|-M)
+ comps=$( __get_machines )
+ ;;
esac
COMPREPLY=( $(compgen -W '$comps' -- "$cur") )
return 0