X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=blobdiff_plain;f=shell-completion%2Fsystemd-bash-completion.sh;h=7848bafc1784136677f8cc2d7bbadc72ed67a539;hp=a5df3bf985bdc431866e66817b5d65a165f833b9;hb=1883552c3d80d44f4cb368874d54c1cb15b83e61;hpb=45db2956baf107c9129af68ae3111391d0ee4640 diff --git a/shell-completion/systemd-bash-completion.sh b/shell-completion/systemd-bash-completion.sh index a5df3bf98..7848bafc1 100644 --- a/shell-completion/systemd-bash-completion.sh +++ b/shell-completion/systemd-bash-completion.sh @@ -60,7 +60,7 @@ _systemctl () { local -A OPTS=( [STANDALONE]='--all -a --defaults --fail --ignore-dependencies --failed --force -f --full --global --help -h --no-ask-password --no-block --no-legend --no-pager --no-reload --no-wall - --order --require --quiet -q --privileged -P --system --user --version --runtime' + --quiet -q --privileged -P --system --user --version --runtime' [ARG]='--host -H --kill-mode --kill-who --property -p --signal -s --type -t --root' ) @@ -100,7 +100,7 @@ _systemctl () { fi local -A VERBS=( - [ALL_UNITS]='is-active is-enabled status show mask preset' + [ALL_UNITS]='is-active is-failed is-enabled status show mask preset' [ENABLED_UNITS]='disable reenable' [DISABLED_UNITS]='enable' [FAILED_UNITS]='reset-failed' @@ -113,7 +113,7 @@ _systemctl () { [JOBS]='cancel' [SNAPSHOTS]='delete' [ENVS]='set-environment unset-environment' - [STANDALONE]='daemon-reexec daemon-reload default dot dump + [STANDALONE]='daemon-reexec daemon-reload default dump emergency exit halt hibernate hybrid-sleep kexec list-jobs list-units list-unit-files poweroff reboot rescue show-environment suspend' @@ -334,6 +334,20 @@ _journalctl() { elif [[ $cur = *=* ]]; then mapfile -t field_vals < <(journalctl -F "${prev%=}" 2>/dev/null) COMPREPLY=( $(compgen -W '${field_vals[*]}' -- "${cur#=}") ) + elif [[ $cur = /dev* ]]; then + compopt -o filenames + COMPREPLY=( $(compgen -f -- "${cur}") ) + elif [[ $cur = /* ]]; then + # Append /dev/ to the list of completions, so that + # after typing / the user sees /dev/ as one + # of the alternatives. Later on the rule above will + # take care of showing device files in /dev/. + mapfile -t field_vals < <(journalctl -F "_EXE" 2>/dev/null; echo '/dev/') + COMPREPLY=( $(compgen -W '${field_vals[*]}' -- "${cur}") ) + if [[ "${COMPREPLY[@]}" = '/dev/' ]]; then + compopt -o filenames + COMPREPLY=( $(compgen -f -- "${cur}") ) + fi elif [[ $prev = '=' ]]; then mapfile -t field_vals < <(journalctl -F "${COMP_WORDS[COMP_CWORD-2]}" 2>/dev/null) COMPREPLY=( $(compgen -W '${field_vals[*]}' -- "$cur") )