diff options
author | Adrian Szyndela <adrian.s@samsung.com> | 2020-03-27 09:11:55 +0100 |
---|---|---|
committer | Adrian Szyndela <adrian.s@samsung.com> | 2020-03-27 09:11:55 +0100 |
commit | b0d0a1cb41408251e852bce998aff876fda0b214 (patch) | |
tree | 7c0539331c52802a9609c708150e3d7fb4283dd7 /shell-completion | |
parent | a70b405fa3b2c4e93db2b3bd858d70b5ef559a1e (diff) | |
parent | 1e5d2d656420d0e755dbcf72aeba3c3aba54e956 (diff) | |
download | systemd-b0d0a1cb41408251e852bce998aff876fda0b214.tar.gz systemd-b0d0a1cb41408251e852bce998aff876fda0b214.tar.bz2 systemd-b0d0a1cb41408251e852bce998aff876fda0b214.zip |
Merge v242 into tizen
systemd v242
Diffstat (limited to 'shell-completion')
-rw-r--r-- | shell-completion/bash/busctl | 9 | ||||
-rw-r--r-- | shell-completion/bash/journalctl | 13 | ||||
-rw-r--r-- | shell-completion/bash/systemctl.in | 5 | ||||
-rw-r--r-- | shell-completion/bash/systemd-id128 | 74 | ||||
-rw-r--r-- | shell-completion/zsh/_journalctl | 2 |
5 files changed, 98 insertions, 5 deletions
diff --git a/shell-completion/bash/busctl b/shell-completion/bash/busctl index 476101c24c..63a7644cbf 100644 --- a/shell-completion/bash/busctl +++ b/shell-completion/bash/busctl @@ -86,7 +86,8 @@ _busctl() { -q --quiet --verbose --expect-reply=no --auto-start=no --allow-interactive-authorization=no --augment-creds=no --watch-bind=yes -j' - [ARG]='--address -H --host -M --machine --match --timeout --size --json' + [ARG]='--address -H --host -M --machine --match --timeout --size --json + --destination' ) if __contains_word "--user" ${COMP_WORDS[*]}; then @@ -106,6 +107,9 @@ _busctl() { --json) comps=$( busctl --json=help 2>/dev/null ) ;; + --destination) + comps=$( __get_busnames $mode ) + ;; esac COMPREPLY=( $(compgen -W '$comps' -- "$cur") ) return 0 @@ -121,6 +125,7 @@ _busctl() { [BUSNAME]='status monitor capture tree' [OBJECT]='introspect' [METHOD]='call' + [EMIT]='emit' [PROPERTY_GET]='get-property' [PROPERTY_SET]='set-property' ) @@ -165,6 +170,8 @@ _busctl() { else comps='' fi + elif __contains_word "$verb" ${VERBS[EMIT]}; then + comps='' elif __contains_word "$verb" ${VERBS[PROPERTY_GET]}; then if [[ $n -eq 1 ]] ; then comps=$( __get_busnames $mode) diff --git a/shell-completion/bash/journalctl b/shell-completion/bash/journalctl index bcd4533a63..3beb347e1b 100644 --- a/shell-completion/bash/journalctl +++ b/shell-completion/bash/journalctl @@ -28,7 +28,7 @@ __contains_word () { __get_machines() { local a b (machinectl list-images --no-legend --no-pager; machinectl list --no-legend --no-pager; echo ".host") | \ - { while read a b; do echo " $a"; done; } | sort -u; + { while read a b; do echo " $a"; done; } | sort -u; } __syslog_priorities=(emerg alert crit err warning notice info debug) @@ -48,10 +48,17 @@ _journalctl() { -M --machine -o --output -u --unit --user-unit -p --priority --root --case-sensitive' [ARGUNKNOWN]='-c --cursor --interval -n --lines -S --since -U --until - --after-cursor --verify-key -g --grep + --after-cursor --cursor-file --verify-key -g --grep --vacuum-size --vacuum-time --vacuum-files --output-fields' ) + # Use the default completion for shell redirect operators + if __contains_word "$prev" '>' '>>' '&>'; then + compopt -o filenames + COMPREPLY=( $(compgen -f -- "$cur") ) + return 0; + fi + if __contains_word "$prev" ${OPTS[ARG]} ${OPTS[ARGUNKNOWN]}; then case $prev in --boot|-b) @@ -70,7 +77,7 @@ _journalctl() { ;; --field|-F) comps=$(journalctl --fields | sort 2>/dev/null) - ;; + ;; --machine|-M) comps=$( __get_machines ) ;; diff --git a/shell-completion/bash/systemctl.in b/shell-completion/bash/systemctl.in index 0e58e2ba4c..d73f956a3f 100644 --- a/shell-completion/bash/systemctl.in +++ b/shell-completion/bash/systemctl.in @@ -84,10 +84,13 @@ __get_restartable_units () { __get_stoppable_units () { # filter out masked and not-found - __filter_units_by_properties $1 ActiveState=active,CanStop=yes $( + local units=$( { __get_not_masked_unit_files $1 $2 __get_active_units $1 $2 } | sort -u ) + __filter_units_by_properties $1 ActiveState=active,CanStop=yes $units + __filter_units_by_properties $1 ActiveState=reloading,CanStop=yes $units + __filter_units_by_properties $1 ActiveState=activating,CanStop=yes $units } __get_reloadable_units () { diff --git a/shell-completion/bash/systemd-id128 b/shell-completion/bash/systemd-id128 new file mode 100644 index 0000000000..cfd5438cb4 --- /dev/null +++ b/shell-completion/bash/systemd-id128 @@ -0,0 +1,74 @@ +# networkctl(1) completion -*- shell-script -*- +# SPDX-License-Identifier: LGPL-2.1+ +# +# This file is part of systemd. +# +# systemd is free software; you can redistribute it and/or modify it +# under the terms of the GNU Lesser General Public License as published by +# the Free Software Foundation; either version 2.1 of the License, or +# (at your option) any later version. +# +# systemd is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with systemd; If not, see <http://www.gnu.org/licenses/>. + +__contains_word () { + local w word=$1; shift + for w in "$@"; do + [[ $w = "$word" ]] && return + done + return 1 +} + +_systemd_id128() { + local i verb comps + local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]} + local -A OPTS=( + [STANDALONE]='-h --help --version -p --pretty' + [ARG]='-a --app-specific' + ) + + local -A VERBS=( + [STANDALONE]='new machine-id boot-id invocation-id help' + ) + + _init_completion || return + + if __contains_word "$prev" ${OPTS[ARG]}; then + case $prev in + --app-specific|-a) + comps="" + ;; + esac + COMPREPLY=( $(compgen -W '$comps' -- "$cur") ) + return 0 + fi + + if [[ "$cur" = -* ]]; then + COMPREPLY=( $(compgen -W '${OPTS[*]}' -- "$cur") ) + return 0 + fi + + for ((i=0; i < COMP_CWORD; i++)); do + if __contains_word "${COMP_WORDS[i]}" ${VERBS[*]} && + ! __contains_word "${COMP_WORDS[i-1]}" ${OPTS[ARG]}; then + verb=${COMP_WORDS[i]} + break + fi + done + + if [[ -z $verb ]]; then + comps=${VERBS[*]} + elif __contains_word "$verb" ${VERBS[STANDALONE]}; then + comps='' + fi + + COMPREPLY=( $(compgen -W '$comps' -- "$cur") ) + return 0 +} + +complete -F _systemd_id128 systemd-id128 diff --git a/shell-completion/zsh/_journalctl b/shell-completion/zsh/_journalctl index aa6ace0485..0520e02de2 100644 --- a/shell-completion/zsh/_journalctl +++ b/shell-completion/zsh/_journalctl @@ -85,6 +85,7 @@ _arguments -s \ {-h,--help}'[Show this help]' \ '--version[Show package version]' \ '--no-pager[Do not pipe output into a pager]' \ + --no-hostname"[Don't show the hostname of local log messages]" \ {-l,--full}'[Show long fields in full]' \ {-a,--all}'[Show all fields, including long and unprintable]' \ {-f,--follow}'[Follow journal]' \ @@ -104,6 +105,7 @@ _arguments -s \ {-p+,--priority=}'[Show only messages within the specified priority range]:priority:_journalctl_field_values PRIORITY' \ {-t+,--identifier=}'[Show only messages with the specified syslog identifier]:identifier:_journalctl_field_values SYSLOG_IDENTIFIER' \ {-c+,--cursor=}'[Start showing entries from the specified cursor]:cursors:_journalctl_field_values __CURSORS' \ + '--cursor-file=[Show entries using cursor store in file]:file:_files' \ '--after-cursor=[Start showing entries from after the specified cursor]:cursors:_journalctl_field_values __CURSORS' \ '--since=[Start showing entries on or newer than the specified date]:YYYY-MM-DD HH\:MM\:SS' \ '--until=[Stop showing entries on or older than the specified date]:YYYY-MM-DD HH\:MM\:SS' \ |