X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=blobdiff_plain;f=shell-completion%2Fsystemd-bash-completion.sh;h=40e66e9d103d477f08cd88a42994f2292922f1bd;hp=5f829b36aefd94a93cc8543befca062bc622b6e5;hb=076a24adf4bfbb9c5aa8167e102c253c7e1c651e;hpb=bd49c40537ff78060b851b85fd5fdb654f34eaf4 diff --git a/shell-completion/systemd-bash-completion.sh b/shell-completion/systemd-bash-completion.sh index 5f829b36a..40e66e9d1 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,9 +113,10 @@ _systemctl () { [JOBS]='cancel' [SNAPSHOTS]='delete' [ENVS]='set-environment unset-environment' - [STANDALONE]='daemon-reexec daemon-reload default dot dump - emergency exit halt kexec list-jobs list-units - list-unit-files poweroff reboot rescue show-environment' + [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' [NAME]='snapshot load' [FILE]='link' ) @@ -281,7 +282,7 @@ _loginctl () { complete -F _loginctl loginctl __journal_fields=(MESSAGE{,_ID} PRIORITY CODE_{FILE,LINE,FUNC} - ERRNO SYSLOG_{FACILITY,IDENTIFIER,PID} + ERRNO SYSLOG_{FACILITY,IDENTIFIER,PID} COREDUMP_EXE _{P,U,G}ID _COMM _EXE _CMDLINE _AUDIT_{SESSION,LOGINUID} _SYSTEMD_{CGROUP,SESSION,UNIT,OWNER_UID} @@ -294,11 +295,12 @@ __journal_fields=(MESSAGE{,_ID} PRIORITY CODE_{FILE,LINE,FUNC} _journalctl() { local field_vals= cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]} local -A OPTS=( - [STANDALONE]='-a --all -b --this-boot --disk-usage -f --follow --header + [STANDALONE]='-a --all --full + -b --this-boot --disk-usage -f --follow --header -h --help -l --local --new-id128 -m --merge --no-pager --no-tail -q --quiet --setup-keys --this-boot --verify - --version' - [ARG]='-D --directory -F --field -o --output -u --unit' + --version --list-catalog --update-catalog' + [ARG]='-D --directory -F --field -o --output -u --unit --user-unit' [ARGUNKNOWN]='-c --cursor --interval -n --lines -p --priority --since --until --verify-key' ) @@ -318,6 +320,9 @@ _journalctl() { --unit|-u) comps=$(journalctl -F '_SYSTEMD_UNIT') ;; + --user-unit) + comps=$(journalctl -F '_SYSTEMD_USER_UNIT') + ;; *) return 0 ;; @@ -332,6 +337,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") ) @@ -349,7 +368,7 @@ _coredumpctl() { local -A VERBS=( [LIST]='list' - [DUMP]='dump' + [DUMP]='dump gdb' ) if __contains_word "$prev" '--output -o'; then @@ -368,6 +387,9 @@ _coredumpctl() { mapfile -t field_vals < <(systemd-coredumpctl -F "${prev%=}" 2>/dev/null) COMPREPLY=( $(compgen -W '${field_vals[*]}' -- "${cur#=}") ) return 0 + elif [[ $prev = '=' ]]; then + mapfile -t field_vals < <(systemd-coredumpctl -F "${COMP_WORDS[COMP_CWORD-2]}" 2>/dev/null) + comps=${field_vals[*]} else for ((i=0; i <= COMP_CWORD; i++)); do if __contains_word "${COMP_WORDS[i]}" ${VERBS[*]}; then @@ -593,7 +615,7 @@ _udevadm() { fi elif __contains_word "$verb" ${VERBS[TESTBUILTIN]}; then - comps='blkid btrfs firmware hwdb input_id kmod path_id usb_id uaccess' + comps='blkid btrfs firmware hwdb input_id kmod net_id path_id usb_id uaccess' fi COMPREPLY=( $(compgen -W '$comps' -- "$cur") )