diff options
author | Andy Wingo <wingo@pobox.com> | 2015-04-08 08:12:20 +0200 |
---|---|---|
committer | Andy Wingo <wingo@pobox.com> | 2015-04-08 08:30:28 +0200 |
commit | 4e46791a9f00ca29537a3ee554841dfa1488ad79 (patch) | |
tree | 52b3c0dc0c66d414acc87903dc37a093e4a1ec91 /shell-completion/bash | |
parent | 313733493e610bb3b027796a1595e353e6c6f3d7 (diff) |
remove shell completion
Diffstat (limited to 'shell-completion/bash')
-rw-r--r-- | shell-completion/bash/bootctl | 60 | ||||
-rw-r--r-- | shell-completion/bash/busctl | 189 | ||||
-rw-r--r-- | shell-completion/bash/coredumpctl | 85 | ||||
-rw-r--r-- | shell-completion/bash/hostnamectl | 64 | ||||
-rw-r--r-- | shell-completion/bash/journalctl | 123 | ||||
-rw-r--r-- | shell-completion/bash/kernel-install | 50 | ||||
-rw-r--r-- | shell-completion/bash/localectl | 92 | ||||
-rw-r--r-- | shell-completion/bash/machinectl | 97 | ||||
-rw-r--r-- | shell-completion/bash/systemctl.in | 267 | ||||
-rw-r--r-- | shell-completion/bash/systemd-analyze | 117 | ||||
-rw-r--r-- | shell-completion/bash/systemd-cat | 57 | ||||
-rw-r--r-- | shell-completion/bash/systemd-cgls | 56 | ||||
-rw-r--r-- | shell-completion/bash/systemd-cgtop | 41 | ||||
-rw-r--r-- | shell-completion/bash/systemd-delta | 61 | ||||
-rw-r--r-- | shell-completion/bash/systemd-detect-virt | 40 | ||||
-rw-r--r-- | shell-completion/bash/systemd-nspawn | 143 | ||||
-rw-r--r-- | shell-completion/bash/systemd-run | 101 | ||||
-rw-r--r-- | shell-completion/bash/timedatectl | 76 |
18 files changed, 0 insertions, 1719 deletions
diff --git a/shell-completion/bash/bootctl b/shell-completion/bash/bootctl deleted file mode 100644 index c86ec7edc..000000000 --- a/shell-completion/bash/bootctl +++ /dev/null @@ -1,60 +0,0 @@ -# bootctl(1) completion -*- shell-script -*- -# -# This file is part of systemd. -# -# Copyright 2014 Thomas H.P. Andersen -# -# 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 -} - -_bootctl() { - local i verb comps - local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]} - local -A OPTS=( - [STANDALONE]='-h --help --version' - ) - - if [[ "$cur" = -* ]]; then - COMPREPLY=( $(compgen -W '${OPTS[*]}' -- "$cur") ) - return 0 - fi - - local -A VERBS=( - [STANDALONE]='status' - ) - - for ((i=0; i < COMP_CWORD; i++)); do - if __contains_word "${COMP_WORDS[i]}" ${VERBS[*]}; 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 _bootctl bootctl diff --git a/shell-completion/bash/busctl b/shell-completion/bash/busctl deleted file mode 100644 index 6a770b1b8..000000000 --- a/shell-completion/bash/busctl +++ /dev/null @@ -1,189 +0,0 @@ -# busctl(1) completion -*- shell-script -*- -# -# This file is part of systemd. -# -# Copyright 2013 Zbigniew Jędrzejewski-Szmek -# Copyright 2014 Thomas H.P. Andersen -# -# 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 -} - -__get_machines() { - local a b - machinectl list --no-legend --no-pager | { while read a b; do echo " $a"; done; }; -} - -__get_busnames() { - local mode=$1 - local a b - busctl $mode list --no-legend --no-pager | { while read a b; do echo " $a"; done; }; -} - -__get_objects() { - local mode=$1 - local busname=$2 - local a b - busctl $mode tree --list --no-legend --no-pager $busname | { while read a b; do echo " $a"; done; }; -} - -__get_interfaces() { - local mode=$1 - local busname=$2 - local path=$3 - local a b - busctl $mode introspect --list --no-legend --no-pager $busname $path | { while read a b c; do [[ "$b" == "interface" ]] && echo " $a"; done; }; -} - -__get_members() { - local mode=$1 - local busname=$2 - local path=$3 - local interface=$4 - local type=$5 - local a b - busctl $mode introspect --list --no-legend --no-pager $busname $path $interface | sed -e 's/^\.//' | { while read a b c; do [[ "$b" == "$type" ]] && echo " $a"; done; }; -} - -__get_signature() { - local mode=$1 - local busname=$2 - local path=$3 - local interface=$4 - local member=$5 - local a b - busctl $mode introspect --list --no-legend --no-pager $busname $path $interface | sed -e 's/^\.//' | { while read a b c d; do [[ "$a" == "$member" ]] && echo " \"$c\""; done; }; -} - -_busctl() { - local i verb comps mode - local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]} - local -A OPTS=( - [STANDALONE]='-h --help --version --no-pager --no-legend --system --user - --show-machine --unique --acquired --activatable --list - --quiet --verbose --expect-reply=no --auto-start=no - --allow-interactive-authorization=yes --augment-creds=no' - [ARG]='-H --host -M --machine --address --match --timeout' - ) - - if __contains_word "--user" ${COMP_WORDS[*]}; then - mode=--user - else - mode=--system - fi - - if __contains_word "$prev" ${OPTS[ARG]}; then - case $prev in - --host|-H) - comps=$(compgen -A hostname) - ;; - --machine|-M) - comps=$( __get_machines ) - esac - COMPREPLY=( $(compgen -W '$comps' -- "$cur") ) - return 0 - fi - - if [[ "$cur" = -* ]]; then - COMPREPLY=( $(compgen -W '${OPTS[*]}' -- "$cur") ) - return 0 - fi - - local -A VERBS=( - [STANDALONE]='list help' - [BUSNAME]='status monitor capture tree' - [OBJECT]='introspect' - [METHOD]='call' - [PROPERTY_GET]='get-property' - [PROPERTY_SET]='set-property' - ) - - 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 - - n=$(($COMP_CWORD - $i)) - - if [[ -z $verb ]]; then - comps=${VERBS[*]} - elif __contains_word "$verb" ${VERBS[STANDALONE]}; then - comps='' - elif __contains_word "$verb" ${VERBS[BUSNAME]}; then - comps=$( __get_busnames $mode) - elif __contains_word "$verb" ${VERBS[OBJECT]}; then - if [[ $n -eq 1 ]] ; then - comps=$( __get_busnames $mode) - elif [[ $n -eq 2 ]] ; then - comps=$( __get_objects $mode ${COMP_WORDS[COMP_CWORD-1]}) - elif [[ $n -eq 3 ]] ; then - comps=$( __get_interfaces $mode ${COMP_WORDS[COMP_CWORD-2]} ${COMP_WORDS[COMP_CWORD-1]}) - else - comps='' - fi - elif __contains_word "$verb" ${VERBS[METHOD]}; then - if [[ $n -eq 1 ]] ; then - comps=$( __get_busnames $mode) - elif [[ $n -eq 2 ]] ; then - comps=$( __get_objects $mode ${COMP_WORDS[COMP_CWORD-1]}) - elif [[ $n -eq 3 ]] ; then - comps=$( __get_interfaces $mode ${COMP_WORDS[COMP_CWORD-2]} ${COMP_WORDS[COMP_CWORD-1]}) - elif [[ $n -eq 4 ]] ; then - comps=$( __get_members $mode ${COMP_WORDS[COMP_CWORD-3]} ${COMP_WORDS[COMP_CWORD-2]} ${COMP_WORDS[COMP_CWORD-1]} method) - elif [[ $n -eq 5 ]] ; then - comps=$( __get_signature $mode ${COMP_WORDS[COMP_CWORD-4]} ${COMP_WORDS[COMP_CWORD-3]} ${COMP_WORDS[COMP_CWORD-2]} ${COMP_WORDS[COMP_CWORD-1]}) - else - comps='' - fi - elif __contains_word "$verb" ${VERBS[PROPERTY_GET]}; then - if [[ $n -eq 1 ]] ; then - comps=$( __get_busnames $mode) - elif [[ $n -eq 2 ]] ; then - comps=$( __get_objects $mode ${COMP_WORDS[COMP_CWORD-1]}) - elif [[ $n -eq 3 ]] ; then - comps=$( __get_interfaces $mode ${COMP_WORDS[COMP_CWORD-2]} ${COMP_WORDS[COMP_CWORD-1]}) - elif [[ $n -eq 4 ]] ; then - comps=$( __get_members $mode ${COMP_WORDS[COMP_CWORD-3]} ${COMP_WORDS[COMP_CWORD-2]} ${COMP_WORDS[COMP_CWORD-1]} property) - else - comps='' - fi - elif __contains_word "$verb" ${VERBS[PROPERTY_SET]}; then - if [[ $n -eq 1 ]] ; then - comps=$( __get_busnames $mode) - elif [[ $n -eq 2 ]] ; then - comps=$( __get_objects $mode ${COMP_WORDS[COMP_CWORD-1]}) - elif [[ $n -eq 3 ]] ; then - comps=$( __get_interfaces $mode ${COMP_WORDS[COMP_CWORD-2]} ${COMP_WORDS[COMP_CWORD-1]}) - elif [[ $n -eq 4 ]] ; then - comps=$( __get_members $mode ${COMP_WORDS[COMP_CWORD-3]} ${COMP_WORDS[COMP_CWORD-2]} ${COMP_WORDS[COMP_CWORD-1]} property) - elif [[ $n -eq 5 ]] ; then - comps=$( __get_signature $mode ${COMP_WORDS[COMP_CWORD-4]} ${COMP_WORDS[COMP_CWORD-3]} ${COMP_WORDS[COMP_CWORD-2]} ${COMP_WORDS[COMP_CWORD-1]}) - else - comps='' - fi - fi - - COMPREPLY=( $(compgen -W '$comps' -- "$cur") ) - return 0 -} - -complete -F _busctl busctl diff --git a/shell-completion/bash/coredumpctl b/shell-completion/bash/coredumpctl deleted file mode 100644 index 609167750..000000000 --- a/shell-completion/bash/coredumpctl +++ /dev/null @@ -1,85 +0,0 @@ -# coredumpctl(1) completion -*- shell-script -*- -# -# This file is part of systemd. -# -# Copyright 2010 Ran Benita -# -# 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 -} - -__journal_fields=(MESSAGE{,_ID} PRIORITY CODE_{FILE,LINE,FUNC} - ERRNO SYSLOG_{FACILITY,IDENTIFIER,PID} COREDUMP_EXE - _{P,U,G}ID _COMM _EXE _CMDLINE - _AUDIT_{SESSION,LOGINUID} - _SYSTEMD_{CGROUP,SESSION,UNIT,OWNER_UID} - _SELINUX_CONTEXT _SOURCE_REALTIME_TIMESTAMP - _{BOOT,MACHINE}_ID _HOSTNAME _TRANSPORT - _KERNEL_{DEVICE,SUBSYSTEM} - _UDEV_{SYSNAME,DEVNODE,DEVLINK} - __CURSOR __{REALTIME,MONOTONIC}_TIMESTAMP) -_coredumpctl() { - local i verb comps - local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]} - local OPTS='-h --help --version --no-pager --no-legend -o --output -F --field -1' - - local -A VERBS=( - [LIST]='list' - [DUMP]='dump gdb' - ) - - if __contains_word "$prev" '--output -o'; then - comps=$( compgen -A file -- "$cur" ) - compopt -o filenames - elif __contains_word "$prev" '--FIELD -F'; then - comps=$( compgen -W '${__journal_fields[*]}' -- "$cur" ) - elif [[ $cur = -* ]]; then - comps=${OPTS} - elif __contains_word "$prev" ${VERBS[*]} && - ! __contains_word ${COMP_WORDS[COMP_CWORD-2]} '--output -o -F --field'; then - compopt -o nospace - COMPREPLY=( $(compgen -W '${__journal_fields[*]}' -S= -- "$cur") ) - return 0 - elif [[ $cur = *=* ]]; then - mapfile -t field_vals < <(coredumpctl -F "${prev%=}" 2>/dev/null) - COMPREPLY=( $(compgen -W '${field_vals[*]}' -- "${cur#=}") ) - return 0 - elif [[ $prev = '=' ]]; then - mapfile -t field_vals < <(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 - verb=${COMP_WORDS[i]} - break - fi - done - - if [[ -z $verb ]]; then - comps=${VERBS[*]} - elif __contains_word "$verb" ${VERBS[LIST]} ${VERBS[DUMP]}; then - comps='' - fi - fi - - COMPREPLY=( $(compgen -W '$comps' -- "$cur") ) - return 0 -} - -complete -F _coredumpctl coredumpctl diff --git a/shell-completion/bash/hostnamectl b/shell-completion/bash/hostnamectl deleted file mode 100644 index 9ad52e03b..000000000 --- a/shell-completion/bash/hostnamectl +++ /dev/null @@ -1,64 +0,0 @@ -# hostnamectl(1) completion -*- shell-script -*- -# -# This file is part of systemd. -# -# Copyright 2010 Ran Benita -# -# 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 -} - -_hostnamectl() { - local i verb comps - local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]} - local OPTS='-h --help --version --transient --static --pretty - --no-ask-password -H --host --machine' - - if [[ $cur = -* ]]; then - COMPREPLY=( $(compgen -W '${OPTS[*]}' -- "$cur") ) - return 0 - fi - - local -A VERBS=( - [STANDALONE]='status' - [ICONS]='set-icon-name' - [NAME]='set-hostname set-deployment' - [CHASSIS]='set-chassis' - ) - - for ((i=0; i < COMP_CWORD; i++)); do - if __contains_word "${COMP_WORDS[i]}" ${VERBS[*]}; then - verb=${COMP_WORDS[i]} - break - fi - done - - if [[ -z $verb ]]; then - comps=${VERBS[*]} - elif __contains_word "$verb" ${VERBS[CHASSIS]}; then - comps='desktop laptop server tablet handset watch embedded vm container' - elif __contains_word "$verb" ${VERBS[STANDALONE]} ${VERBS[ICONS]} ${VERBS[NAME]}; then - comps='' - fi - - COMPREPLY=( $(compgen -W '$comps' -- "$cur") ) - return 0 -} - -complete -F _hostnamectl hostnamectl diff --git a/shell-completion/bash/journalctl b/shell-completion/bash/journalctl deleted file mode 100644 index 1387524a8..000000000 --- a/shell-completion/bash/journalctl +++ /dev/null @@ -1,123 +0,0 @@ -# journalctl(1) completion -*- shell-script -*- -# -# This file is part of systemd. -# -# Copyright 2010 Ran Benita -# -# 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 -} - -__journal_fields=(MESSAGE{,_ID} PRIORITY CODE_{FILE,LINE,FUNC} - ERRNO SYSLOG_{FACILITY,IDENTIFIER,PID} COREDUMP_EXE - _{P,U,G}ID _COMM _EXE _CMDLINE - _AUDIT_{SESSION,LOGINUID} - _SYSTEMD_{CGROUP,SESSION,UNIT,OWNER_UID} - _SELINUX_CONTEXT _SOURCE_REALTIME_TIMESTAMP - _{BOOT,MACHINE}_ID _HOSTNAME _TRANSPORT - _KERNEL_{DEVICE,SUBSYSTEM} - _UDEV_{SYSNAME,DEVNODE,DEVLINK} - __CURSOR __{REALTIME,MONOTONIC}_TIMESTAMP) - -__syslog_priorities=(emerg alert crit err warning notice info debug) - -_journalctl() { - local field_vals= cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]} - local -A OPTS=( - [STANDALONE]='-a --all --full --system --user - --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 --list-catalog --update-catalog --list-boots - --show-cursor --dmesg -k --pager-end -e -r --reverse - --utc -x --catalog --no-full --force --dump-catalog - --flush' - [ARG]='-b --boot --this-boot -D --directory --file -F --field - -o --output -u --unit --user-unit -p --priority' - [ARGUNKNOWN]='-c --cursor --interval -n --lines --since --until - --after-cursor --verify-key --identifier - --root --machine' - ) - - if __contains_word "$prev" ${OPTS[ARG]} ${OPTS[ARGUNKNOWN]}; then - case $prev in - --boot|--this-boot|-b) - comps=$(journalctl -F '_BOOT_ID' 2>/dev/null) - ;; - --directory|-D) - comps=$(compgen -d -- "$cur") - compopt -o filenames - ;; - --file) - comps=$(compgen -f -- "$cur") - compopt -o filenames - ;; - --output|-o) - comps='short short-iso short-precise short-monotonic verbose export json json-pretty json-sse cat' - ;; - --field|-F) - comps=${__journal_fields[*]} - ;; - --priority|-p) - comps=${__syslog_priorities[*]} - ;; - --unit|-u) - comps=$(journalctl -F '_SYSTEMD_UNIT' 2>/dev/null) - ;; - --user-unit) - comps=$(journalctl -F '_SYSTEMD_USER_UNIT' 2>/dev/null) - ;; - *) - return 0 - ;; - esac - COMPREPLY=( $(compgen -W '$comps' -- "$cur") ) - return 0 - fi - - if [[ $cur = -* ]]; then - COMPREPLY=( $(compgen -W '${OPTS[*]}' -- "$cur") ) - return 0 - 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 /<TAB><TAB> 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") ) - else - compopt -o nospace - COMPREPLY=( $(compgen -W '${__journal_fields[*]}' -S= -- "$cur") ) - fi -} - -complete -F _journalctl journalctl diff --git a/shell-completion/bash/kernel-install b/shell-completion/bash/kernel-install deleted file mode 100644 index 7cd2494cf..000000000 --- a/shell-completion/bash/kernel-install +++ /dev/null @@ -1,50 +0,0 @@ -# kernel-install(8) completion -*- shell-script -*- -# -# This file is part of systemd. -# -# Copyright 2013 Kay Sievers -# Copyright 2013 Harald Hoyer -# -# 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/>. - -_kernel_install() { - local comps - local MACHINE_ID - local cur=${COMP_WORDS[COMP_CWORD]} - - case $COMP_CWORD in - 1) - comps="add remove" - ;; - 2) - comps=$(cd /lib/modules; echo [0-9]*) - if [[ ${COMP_WORDS[1]} == "remove" ]] && [[ -f /etc/machine-id ]]; then - read MACHINE_ID < /etc/machine-id - if [[ $MACHINE_ID ]] && ( [[ -d /boot/$MACHINE_ID ]] || [[ -L /boot/$MACHINE_ID ]] ); then - comps=$(cd "/boot/$MACHINE_ID"; echo [0-9]*) - fi - fi - ;; - 3) - [[ "$cur" ]] || cur=/boot/vmlinuz-${COMP_WORDS[2]} - comps=$(compgen -f -- "$cur") - compopt -o filenames - ;; - esac - - COMPREPLY=( $(compgen -W '$comps' -- "$cur") ) - return 0 -} - -complete -F _kernel_install kernel-install diff --git a/shell-completion/bash/localectl b/shell-completion/bash/localectl deleted file mode 100644 index e0c06a794..000000000 --- a/shell-completion/bash/localectl +++ /dev/null @@ -1,92 +0,0 @@ -# localectl(1) completion -*- shell-script -*- -# -# This file is part of systemd. -# -# Copyright 2010 Ran Benita -# -# 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 -} - -__locale_fields=( LANG LANGUAGE LC_CTYPE LC_NUMERIC LC_TIME \ - LC_COLLATE LC_MONETARY LC_MESSAGES LC_PAPER \ - LC_NAME LC_ADDRESS LC_TELEPHONE \ - LC_MEASUREMENT LC_IDENTIFICATION ) -# LC_ALL is omitted on purpose - -_localectl() { - local i verb comps locale_vals - local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]} - local OPTS='-h --help --version --no-convert --no-pager --no-ask-password - -H --host --machine' - - if __contains_word "$prev" $OPTS; then - case $prev in - --host|-H) - comps='' - ;; - esac - COMPREPLY=( $(compgen -W '$comps' -- "$cur") ) - return 0 - fi - - if [[ $cur = -* ]]; then - COMPREPLY=( $(compgen -W '${OPTS[*]}' -- "$cur") ) - return 0 - fi - - local -A VERBS=( - [STANDALONE]='status list-locales list-keymaps' - [LOCALES]='set-locale' - [KEYMAPS]='set-keymap' - [X11]='set-x11-keymap' - ) - - for ((i=0; i < COMP_CWORD; i++)); do - if __contains_word "${COMP_WORDS[i]}" ${VERBS[*]}; then - verb=${COMP_WORDS[i]} - break - fi - done - - if [[ -z $verb ]]; then - comps=${VERBS[*]} - elif __contains_word "$verb" ${VERBS[LOCALES]}; then - if [[ $cur = *=* ]]; then - mapfile -t locale_vals < <(command localectl list-locales 2>/dev/null) - COMPREPLY=( $(compgen -W '${locale_vals[*]}' -- "${cur#=}") ) - elif [[ $prev = "=" ]]; then - mapfile -t locale_vals < <(command localectl list-locales 2>/dev/null) - COMPREPLY=( $(compgen -W '${locale_vals[*]}' -- "$cur") ) - else - compopt -o nospace - COMPREPLY=( $(compgen -W '${__locale_fields[*]}' -S= -- "$cur") ) - fi - return 0 - elif __contains_word "$verb" ${VERBS[KEYMAPS]}; then - comps=$(command localectl list-keymaps) - elif __contains_word "$verb" ${VERBS[STANDALONE]} ${VERBS[X11]}; then - comps='' - fi - - COMPREPLY=( $(compgen -W '$comps' -- "$cur") ) - return 0 -} - -complete -F _localectl localectl diff --git a/shell-completion/bash/machinectl b/shell-completion/bash/machinectl deleted file mode 100644 index 3789492d7..000000000 --- a/shell-completion/bash/machinectl +++ /dev/null @@ -1,97 +0,0 @@ -# machinectl(1) completion -*- shell-script -*- -# -# This file is part of systemd. -# -# Copyright 2014 Thomas H.P. Andersen -# -# 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 -} - -__get_machines() { - local a b - machinectl list --no-legend --no-pager | { while read a b; do echo " $a"; done; }; -} - -_machinectl() { - local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]} - local i verb comps - - local -A OPTS=( - [STANDALONE]='--all -a --full --help -h --no-ask-password --no-legend --no-pager --version' - [ARG]='--host -H --kill-who -M --machine --property -p --signal -s' - ) - - local -A VERBS=( - [STANDALONE]='list' - [MACHINES]='status show terminate kill reboot login' - ) - - _init_completion || return - - 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 __contains_word "$prev" ${OPTS[ARG]}; then - case $prev in - --signal|-s) - comps=$(compgen -A signal) - ;; - --kill-who) - comps='all leader' - ;; - --host|-H) - comps=$(compgen -A hostname) - ;; - --machine|-M) - comps=$( __get_machines ) - ;; - --property|-p) - comps='' - ;; - esac - COMPREPLY=( $(compgen -W '$comps' -- "$cur") ) - return 0 - fi - - if [[ "$cur" = -* ]]; then - COMPREPLY=( $(compgen -W '${OPTS[*]}' -- "$cur") ) - return 0 - fi - - if [[ -z $verb ]]; then - comps=${VERBS[*]} - - elif __contains_word "$verb" ${VERBS[STANDALONE]}; then - comps='' - - elif __contains_word "$verb" ${VERBS[MACHINES]}; then - comps=$( __get_machines ) - fi - - COMPREPLY=( $(compgen -W '$comps' -- "$cur") ) - return 0 -} - -complete -F _machinectl machinectl diff --git a/shell-completion/bash/systemctl.in b/shell-completion/bash/systemctl.in deleted file mode 100644 index 8063316ec..000000000 --- a/shell-completion/bash/systemctl.in +++ /dev/null @@ -1,267 +0,0 @@ -# systemctl(1) completion -*- shell-script -*- -# -# This file is part of systemd. -# -# Copyright 2010 Ran Benita -# -# 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/>. - -__systemctl() { - local mode=$1; shift 1 - systemctl $mode --full --no-legend "$@" -} - -__systemd_properties() { - local mode=$1 - { __systemctl $mode show --all; - @rootlibexecdir@/systemd --dump-configuration-items; } | - while IFS='=' read -r key value; do - [[ $value ]] && echo "$key" - done -} - -__contains_word () { - local w word=$1; shift - for w in "$@"; do - [[ $w = "$word" ]] && return - done -} - -__filter_units_by_property () { - local mode=$1 property=$2 value=$3 ; shift 3 - local units=("$@") - local props - IFS=$'\n' read -rd '' -a props < \ - <(__systemctl $mode show --property "$property" -- "${units[@]}") - for ((i=0; $i < ${#units[*]}; i++)); do - if [[ "${props[i]}" = "$property=$value" ]]; then - echo " ${units[i]}" - fi - done -} - -__get_all_units () { { __systemctl $1 list-unit-files; __systemctl $1 list-units --all; } \ - | { while read -r a b; do [[ $a =~ @\. ]] || echo " $a"; done; }; } -__get_template_names () { __systemctl $1 list-unit-files \ - | { while read -r a b; do [[ $a =~ @\. ]] && echo " ${a%%@.*}@"; done; }; } - -__get_active_units () { __systemctl $1 list-units \ - | { while read -r a b; do echo " $a"; done; }; } -__get_startable_units () { - # find startable inactive units - __filter_units_by_property $mode ActiveState inactive $( - __filter_units_by_property $mode CanStart yes $( - __systemctl $mode list-unit-files --state enabled,disabled,static | \ - { while read -r a b; do [[ $a =~ @\. ]] || echo " $a"; done; } - __systemctl $mode list-units --state inactive,failed | \ - { while read -r a b; do echo " $a"; done; } )) -} -__get_restartable_units () { - # filter out masked and not-found - __filter_units_by_property $mode CanStart yes $( - __systemctl $mode list-unit-files --state enabled,disabled,static | \ - { while read -r a b; do [[ $a =~ @\. ]] || echo " $a"; done; } - __systemctl $mode list-units | \ - { while read -r a b; do echo " $a"; done; } ) -} -__get_failed_units () { __systemctl $1 list-units \ - | { while read -r a b c d; do [[ $c == "failed" ]] && echo " $a"; done; }; } -__get_enabled_units () { __systemctl $1 list-unit-files \ - | { while read -r a b c ; do [[ $b == "enabled" ]] && echo " $a"; done; }; } -__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; }; } -__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]} - local i verb comps mode - - local -A OPTS=( - [STANDALONE]='--all -a --reverse --after --before --defaults --fail --ignore-dependencies --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' - [ARG]='--host -H --kill-who --property -p --signal -s --type -t --state --root' - ) - - if __contains_word "--user" ${COMP_WORDS[*]}; then - mode=--user - else - mode=--system - fi - - if __contains_word "$prev" ${OPTS[ARG]}; then - case $prev in - --signal|-s) - comps=$(compgen -A signal) - ;; - --type|-t) - comps='automount busname device mount path service snapshot socket swap target timer' - ;; - --state) - comps='loaded not-found stub - active inactive - dead elapsed exited listening mounted plugged running waiting' - ;; - --kill-who) - comps='all control main' - ;; - --root) - comps=$(compgen -A directory -- "$cur" ) - compopt -o filenames - ;; - --host|-H) - comps=$(compgen -A hostname) - ;; - --property|-p) - comps=$(__systemd_properties $mode) - ;; - esac - COMPREPLY=( $(compgen -W '$comps' -- "$cur") ) - return 0 - fi - - if [[ "$cur" = -* ]]; then - COMPREPLY=( $(compgen -W '${OPTS[*]}' -- "$cur") ) - return 0 - fi - - local -A VERBS=( - [ALL_UNITS]='is-active is-failed is-enabled status show cat mask preset help list-dependencies edit' - [ENABLED_UNITS]='disable' - [DISABLED_UNITS]='enable' - [REENABLABLE_UNITS]='reenable' - [FAILED_UNITS]='reset-failed' - [STARTABLE_UNITS]='start' - [STOPPABLE_UNITS]='stop condstop kill try-restart condrestart' - [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' - [ENVS]='set-environment unset-environment' - [STANDALONE]='daemon-reexec daemon-reload default - emergency exit halt hibernate hybrid-sleep kexec list-jobs - list-sockets list-timers list-units list-unit-files poweroff - reboot rescue show-environment suspend get-default - is-system-running' - [NAME]='snapshot' - [FILE]='link' - [TARGETS]='set-default' - ) - - 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[ALL_UNITS]}; then - comps=$( __get_all_units $mode ) - compopt -o filenames - - elif __contains_word "$verb" ${VERBS[ENABLED_UNITS]}; then - comps=$( __get_enabled_units $mode ) - compopt -o filenames - - elif __contains_word "$verb" ${VERBS[DISABLED_UNITS]}; then - comps=$( __get_disabled_units $mode; - __get_template_names $mode) - compopt -o filenames - - elif __contains_word "$verb" ${VERBS[REENABLABLE_UNITS]}; then - comps=$( __get_disabled_units $mode; - __get_enabled_units $mode; - __get_template_names $mode) - compopt -o filenames - - elif __contains_word "$verb" ${VERBS[STARTABLE_UNITS]}; then - comps=$( __get_startable_units $mode; - __get_template_names $mode) - compopt -o filenames - - elif __contains_word "$verb" ${VERBS[RESTARTABLE_UNITS]}; then - comps=$( __get_restartable_units $mode; - __get_template_names $mode) - compopt -o filenames - - elif __contains_word "$verb" ${VERBS[STOPPABLE_UNITS]}; then - comps=$( __filter_units_by_property $mode CanStop yes \ - $( __get_active_units $mode ) ) - compopt -o filenames - - elif __contains_word "$verb" ${VERBS[RELOADABLE_UNITS]}; then - comps=$( __filter_units_by_property $mode CanReload yes \ - $( __get_active_units $mode ) ) - compopt -o filenames - - elif __contains_word "$verb" ${VERBS[ISOLATABLE_UNITS]}; then - comps=$( __filter_units_by_property $mode AllowIsolate yes \ - $( __get_all_units $mode ) ) - compopt -o filenames - - elif __contains_word "$verb" ${VERBS[FAILED_UNITS]}; then - comps=$( __get_failed_units $mode ) - compopt -o filenames - - elif __contains_word "$verb" ${VERBS[MASKED_UNITS]}; then - 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[JOBS]}; then - comps=$( __systemctl $mode list-jobs | { while read -r a b; do echo " $a"; done; } ) - - elif __contains_word "$verb" ${VERBS[SNAPSHOTS]}; then - comps=$( __systemctl $mode list-units --type snapshot --full --all \ - | { while read -r a b; do echo " $a"; done; } ) - - elif __contains_word "$verb" ${VERBS[ENVS]}; then - comps=$( __systemctl $mode show-environment \ - | while read -r line; do echo " ${line%%=*}=";done ) - compopt -o nospace - - elif __contains_word "$verb" ${VERBS[FILE]}; then - comps=$( compgen -A file -- "$cur" ) - compopt -o filenames - elif __contains_word "$verb" ${VERBS[TARGETS]}; then - comps=$( __systemctl $mode list-unit-files --type target --full --all \ - | { while read -r a b; do echo " $a"; done; } ) - fi - - COMPREPLY=( $(compgen -o filenames -W '$comps' -- "$cur") ) - return 0 -} - -complete -F _systemctl systemctl diff --git a/shell-completion/bash/systemd-analyze b/shell-completion/bash/systemd-analyze deleted file mode 100644 index 00947029c..000000000 --- a/shell-completion/bash/systemd-analyze +++ /dev/null @@ -1,117 +0,0 @@ -# systemd-analyze(1) completion -*- shell-script -*- -# -# This file is part of systemd. -# -# Copyright 2010 Ran Benita -# Copyright 2013 Harald Hoyer -# -# 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 -} - -__get_machines() { - local a b - machinectl list --no-legend --no-pager | { while read a b; do echo " $a"; done; }; -} - -_systemd_analyze() { - local i verb comps - local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]} - - local -A OPTS=( - [STANDALONE]='--help --version --system --user --from-pattern --to-pattern --order --require --no-pager' - [ARG]='-H --host -M --machine --fuzz --man' - ) - - local -A VERBS=( - [STANDALONE]='time blame plot dump' - [CRITICAL_CHAIN]='critical-chain' - [DOT]='dot' - [LOG_LEVEL]='set-log-level' - [VERIFY]='verify' - ) - - _init_completion || return - - 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 __contains_word "$prev" ${OPTS[ARG]}; then - case $prev in - --host|-H) - comps=$(compgen -A hostname) - ;; - --machine|-M) - comps=$( __get_machines ) - ;; - esac - COMPREPLY=( $(compgen -W '$comps' -- "$cur") ) - return 0 - fi - - if [[ -z $verb && $cur = -* ]]; then - COMPREPLY=( $(compgen -W '${OPTS[*]}' -- "$cur") ) - return 0 - fi - - if [[ -z $verb ]]; then - comps=${VERBS[*]} - - elif __contains_word "$verb" ${VERBS[STANDALONE]}; then - if [[ $cur = -* ]]; then - comps='--help --version --system --user' - fi - - elif __contains_word "$verb" ${VERBS[CRITICAL_CHAIN]}; then - if [[ $cur = -* ]]; then - comps='--help --version --system --user --fuzz' - fi - - elif __contains_word "$verb" ${VERBS[DOT]}; then - if [[ $cur = -* ]]; then - comps='--help --version --system --user --from-pattern --to-pattern --order --require' - fi - - elif __contains_word "$verb" ${VERBS[LOG_LEVEL]}; then - if [[ $cur = -* ]]; then - comps='--help --version --system --user' - else - comps='debug info notice warning err crit alert emerg' - fi - - elif __contains_word "$verb" ${VERBS[VERIFY]}; then - if [[ $cur = -* ]]; then - comps='--help --version --system --user --no-man' - else - comps=$( compgen -A file -- "$cur" ) - compopt -o filenames - fi - - fi - - COMPREPLY=( $(compgen -W '$comps' -- "$cur") ) - return 0 -} - -complete -F _systemd_analyze systemd-analyze diff --git a/shell-completion/bash/systemd-cat b/shell-completion/bash/systemd-cat deleted file mode 100644 index 8d84042af..000000000 --- a/shell-completion/bash/systemd-cat +++ /dev/null @@ -1,57 +0,0 @@ -# systemd-cat(1) completion -*- shell-script -*- -# -# This file is part of systemd. -# -# Copyright 2014 Thomas H.P. Andersen -# -# 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 -} - -_systemd_cat() { - local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]} - local i verb comps - - local -A OPTS=( - [STANDALONE]='-h --help --version' - [ARG]='-t --identifier -p --priority --level-prefix' - ) - - _init_completion || return - - if __contains_word "$prev" ${OPTS[ARG]}; then - case $prev in - --identifier|-t) - comps='' - ;; - --priority|-p) - comps='emerg alert crit err warning notice info debug' - ;; - --level-prefix) - comps='yes no' - ;; - esac - COMPREPLY=( $(compgen -W '$comps' -- "$cur") ) - return 0 - fi - - COMPREPLY=( $(compgen -W '${OPTS[*]}' -- "$cur") ) -} - -complete -F _systemd_cat systemd-cat diff --git a/shell-completion/bash/systemd-cgls b/shell-completion/bash/systemd-cgls deleted file mode 100644 index 057043866..000000000 --- a/shell-completion/bash/systemd-cgls +++ /dev/null @@ -1,56 +0,0 @@ -# systemd-cgls(1) completion -*- shell-script -*- -# -# This file is part of systemd. -# -# Copyright 2014 Thomas H.P. Andersen -# -# 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 -} - -__get_machines() { - local a b - machinectl list --no-legend --no-pager | { while read a b; do echo " $a"; done; }; -} - -_systemd_cgls() { - local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]} - local i verb comps - - local -A OPTS=( - [STANDALONE]='-h --help --version --all -l --full -k --no-pager' - [ARG]='-M --machine' - ) - - _init_completion || return - - if __contains_word "$prev" ${OPTS[ARG]}; then - case $prev in - --machine|-M) - comps=$( __get_machines ) - ;; - esac - COMPREPLY=( $(compgen -W '$comps' -- "$cur") ) - return 0 - fi - - COMPREPLY=( $(compgen -W '${OPTS[*]}' -- "$cur") ) -} - -complete -F _systemd_cgls systemd-cgls diff --git a/shell-completion/bash/systemd-cgtop b/shell-completion/bash/systemd-cgtop deleted file mode 100644 index 50464990a..000000000 --- a/shell-completion/bash/systemd-cgtop +++ /dev/null @@ -1,41 +0,0 @@ -# systemd-cgtop(1) completion -*- shell-script -*- -# -# This file is part of systemd. -# -# Copyright 2014 Thomas H.P. Andersen -# -# 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 -} - -_systemd_cgtop() { - local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]} - local comps - - local -A OPTS=( - [STANDALONE]='-h --help --version -p -t -c -m -i -b --batch -n --iterations -d --delay' - [ARG]='--cpu --depth' - ) - - _init_completion || return - - COMPREPLY=( $(compgen -W '${OPTS[*]}' -- "$cur") ) -} - -complete -F _systemd_cgtop systemd-cgtop diff --git a/shell-completion/bash/systemd-delta b/shell-completion/bash/systemd-delta deleted file mode 100644 index cb1732895..000000000 --- a/shell-completion/bash/systemd-delta +++ /dev/null @@ -1,61 +0,0 @@ -# systemd-delta(1) completion -*- shell-script -*- -# -# This file is part of systemd. -# -# Copyright 2014 Thomas H.P. Andersen -# -# 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 -} - -_systemd-delta() { - local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]} - local comps - - local -A OPTS=( - [STANDALONE]='--help -h --no-pager --version' - [ARG]='--diff --type -t' - ) - - _init_completion || return - - - if __contains_word "$prev" ${OPTS[ARG]}; then - case $prev in - --diff) - comps='yes no' - ;; - --type|-t) - comps='masked equivalent redirected overridden unchanged extended default' - ;; - esac - COMPREPLY=( $(compgen -W '$comps' -- "$cur") ) - return 0 - fi - - if [[ "$cur" = -* ]]; then - COMPREPLY=( $(compgen -W '${OPTS[*]}' -- "$cur") ) - return 0 - fi - - COMPREPLY=( $(compgen -W '$comps' -- "$cur") ) - return 0 -} - -complete -F _systemd-delta systemd-delta diff --git a/shell-completion/bash/systemd-detect-virt b/shell-completion/bash/systemd-detect-virt deleted file mode 100644 index df06c2984..000000000 --- a/shell-completion/bash/systemd-detect-virt +++ /dev/null @@ -1,40 +0,0 @@ -# systemd-detect-virt(1) completion -*- shell-script -*- -# -# This file is part of systemd. -# -# Copyright 2014 Thomas H.P. Andersen -# -# 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 -} - -_systemd_detect_virt() { - local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]} - local i verb comps - - local -A OPTS=( - [STANDALONE]='-h --help --version -c --container -v --vm -q --quiet' - ) - - _init_completion || return - - COMPREPLY=( $(compgen -W '${OPTS[*]}' -- "$cur") ) -} - -complete -F _systemd_detect_virt systemd-detect-virt diff --git a/shell-completion/bash/systemd-nspawn b/shell-completion/bash/systemd-nspawn deleted file mode 100644 index 83e34ef02..000000000 --- a/shell-completion/bash/systemd-nspawn +++ /dev/null @@ -1,143 +0,0 @@ -# systemd-nspawn(1) completion -*- shell-script -*- -# -# This file is part of systemd. -# -# Copyright 2014 Thomas H.P. Andersen -# -# 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 -} - -__get_users() { - local a b - loginctl list-users --no-legend --no-pager | { while read a b; do echo " $b"; done; }; -} - -__get_slices() { - local a b - systemctl list-units -t slice --no-legend --no-pager | { while read a b; do echo " $a"; done; }; -} - -__get_machines() { - local a b - machinectl list --no-legend --no-pager | { while read a b; do echo " $a"; done; }; -} - -__get_env() { - local a - env | { while read a; do echo " ${a%%=*}"; done; }; -} - -__get_interfaces(){ - cut -f 1 -d ' ' /proc/net/dev | tail -n +3 | tr -s '\n' | tr -d ':' | xargs -} - -_systemd_nspawn() { - local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]} - local i verb comps - - local -A OPTS=( - [STANDALONE]='-h --help --version --private-network -b --boot --read-only -q --quiet --share-system --keep-unit --network-veth -j' - [ARG]='-D --directory -u --user --uuid --capability --drop-capability --link-journal --bind --bind-ro -M --machine - -S --slice --setenv -Z --selinux-context -L --selinux-apifs-context --register --network-interface --network-bridge - --personality -i --image --tmpfs --volatile - --network-macvlan' - ) - - _init_completion || return - - if __contains_word "$prev" ${OPTS[ARG]}; then - case $prev in - --directory|-D) - compopt -o nospace - comps=$(compgen -S/ -A directory -- "$cur" ) - ;; - --user|-u) - comps=$( __get_users ) - ;; - --uuid) - comps='' - ;; - --capability) - comps='CAP_BLOCK_SUSPEND CAP_IPC_LOCK CAP_MAC_ADMIN CAP_MAC_OVERRIDE CAP_SYS_MODULE CAP_SYS_PACCT CAP_SYS_RAWIO - CAP_SYS_TIME CAP_SYSLOG CAP_WAKE_ALARM CAP_NET_ADMIN' - ;; - --drop-capability) - comps='CAP_AUDIT_CONTROL CAP_AUDIT_WRITE CAP_CHOWN CAP_DAC_OVERRIDE CAP_DAC_READ_SEARCH CAP_FOWNER CAP_FSETID - CAP_IPC_OWNER CAP_KILL CAP_LEASE CAP_LINUX_IMMUTABLE CAP_MKNOD CAP_NET_ADMIN CAP_NET_BIND_SERVICE - CAP_NET_BROADCAST CAP_NET_RAW CAP_SETFCAP CAP_SETGID CAP_SETPCAP CAP_SETUID CAP_SYS_ADMIN CAP_SYS_BOOT - CAP_SYS_CHROOT CAP_SYS_NICE CAP_SYS_PTRACE CAP_SYS_RESOURCE CAP_SYS_TTY_CONFIG' - ;; - --link-journal) - comps='no auto guest host' - ;; - --bind|--bind-ro) - compopt -o nospace - comps=$(compgen -S/ -A directory -- "$cur" ) - ;; - --tmpfs) - compopt -o nospace - comps=$(compgen -S/ -A directory -- "$cur" ) - ;; - --machine|-M) - comps=$( __get_machines ) - ;; - --slice|-S) - comps=$( __get_slices ) - ;; - --setenv) - comps=$( __get_env ) - ;; - --selinux-context|-Z) - comps='' - ;; - --selinux-apifs-context|-L) - comps='' - ;; - --register) - comps='yes no' - ;; - --network-interface) - comps=$(__get_interfaces) - ;; - --network-bridge) - comps='' - ;; - --network-macvlan) - comps='' - ;; - --personality) - comps='x86 x86-64' - ;; - --volatile) - comps='yes state no' - ;; - --image|-i) - compopt -o nospace - comps=$( compgen -A file -- "$cur" ) - ;; - esac - COMPREPLY=( $(compgen -W '$comps' -- "$cur") ) - return 0 - fi - - COMPREPLY=( $(compgen -W '${OPTS[*]}' -- "$cur") ) -} - -complete -F _systemd_nspawn systemd-nspawn diff --git a/shell-completion/bash/systemd-run b/shell-completion/bash/systemd-run deleted file mode 100644 index 712655caf..000000000 --- a/shell-completion/bash/systemd-run +++ /dev/null @@ -1,101 +0,0 @@ -# systemd-run(1) completion -*- shell-script -*- -# -# This file is part of systemd. -# -# Copyright 2013 Zbigniew Jędrzejewski-Szmek -# -# 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/>. - -__systemctl() { - local mode=$1; shift 1 - systemctl $mode --full --no-legend "$@" -} - -__get_slice_units () { __systemctl $1 list-units --all -t slice \ - | { while read -r a b c d; do echo " $a"; done; }; } - -__get_machines() { - local a b - machinectl list --no-legend --no-pager | { while read a b; do echo " $a"; done; }; -} - -_systemd_run() { - local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]} - local OPTS='-h --help --version --user --system --scope --unit --description --slice - -r --remain-after-exit --send-sighup -H --host -M --machine --service-type - --uid --gid --nice --setenv -p --property' - - local mode=--system - local i - for (( i=1; i <= COMP_CWORD; i++ )); do - if [[ ${COMP_WORDS[i]} != -* ]]; then - local root_command=${COMP_WORDS[i]} - _command_offset $i - return - fi - - [[ ${COMP_WORDS[i]} == "--user" ]] && mode=--user - - [[ $i -lt $COMP_CWORD && ${COMP_WORDS[i]} == @(--unit|--description|--slice|--service-type|-H|--host|-M|--machine|-p|--property) ]] && ((i++)) - done - - case "$prev" in - --unit|--description) - # argument required but no completions available - return - ;; - --slice) - local comps=$(__get_slice_units $mode) - - COMPREPLY=( $(compgen -W '$comps' -- "$cur") ) - return 0 - ;; - --service-type) - local comps='simple forking oneshot dbus notify idle' - - COMPREPLY=( $(compgen -W '$comps' -- "$cur") ) - return 0 - ;; - -p|--property) - local comps='CPUAccounting= MemoryAccounting= BlockIOAccounting= SendSIGHUP= - SendSIGKILL= MemoryLimit= CPUShares= BlockIOWeight= User= Group= - DevicePolicy= KillMode= DeviceAllow= BlockIOReadBandwidth= - BlockIOWriteBandwidth= BlockIODeviceWeight= Nice= Environment= - KillSignal= LimitCPU= LimitFSIZE= LimitDATA= LimitSTACK= - LimitCORE= LimitRSS= LimitNOFILE= LimitAS= LimitNPROC= - LimitMEMLOCK= LimitLOCKS= LimitSIGPENDING= LimitMSGQUEUE= - LimitNICE= LimitRTPRIO= LimitRTTIME=' - - COMPREPLY=( $(compgen -W '$comps' -- "$cur") ) - return 0 - ;; - -H|--host) - local comps=$(compgen -A hostname) - - COMPREPLY=( $(compgen -W '$comps' -- "$cur") ) - return 0 - ;; - -M|--machine) - local comps=$( __get_machines ) - - COMPREPLY=( $(compgen -W '$comps' -- "$cur") ) - return 0 - ;; - esac - - COMPREPLY=( $(compgen -W '${OPTS[*]}' -- "$cur") ) - return 0 -} - -complete -F _systemd_run systemd-run diff --git a/shell-completion/bash/timedatectl b/shell-completion/bash/timedatectl deleted file mode 100644 index a57fbd254..000000000 --- a/shell-completion/bash/timedatectl +++ /dev/null @@ -1,76 +0,0 @@ -# timedatectl(1) completion -*- shell-script -*- -# -# This file is part of systemd. -# -# Copyright 2010 Ran Benita -# -# 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 -} - -_timedatectl() { - local i verb comps - local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]} - local OPTS='-h --help --version --adjust-system-clock --no-pager - --no-ask-password -H --host --machine' - - if __contains_word "$prev" $OPTS; then - case $prev in - --host|-H) - comps='' - ;; - esac - COMPREPLY=( $(compgen -W '$comps' -- "$cur") ) - return 0 - fi - - if [[ $cur = -* ]]; then - COMPREPLY=( $(compgen -W '${OPTS[*]}' -- "$cur") ) - return 0 - fi - - local -A VERBS=( - [BOOLEAN]='set-local-rtc set-ntp' - [STANDALONE]='status set-time list-timezones' - [TIMEZONES]='set-timezone' - [TIME]='set-time' - ) - - for ((i=0; i < COMP_CWORD; i++)); do - if __contains_word "${COMP_WORDS[i]}" ${VERBS[*]}; then - verb=${COMP_WORDS[i]} - break - fi - done - - if [[ -z $verb ]]; then - comps=${VERBS[*]} - elif __contains_word "$verb" ${VERBS[BOOLEAN]}; then - comps='true false' - elif __contains_word "$verb" ${VERBS[TIMEZONES]}; then - comps=$(command timedatectl list-timezones) - elif __contains_word "$verb" ${VERBS[STANDALONE]} ${VERBS[TIME]}; then - comps='' - fi - - COMPREPLY=( $(compgen -W '$comps' -- "$cur") ) - return 0 -} - -complete -F _timedatectl timedatectl |