1 # systemd-nspawn(1) completion -*- shell-script -*-
3 # This file is part of systemd.
5 # Copyright 2014 Thomas H.P. Andersen
7 # systemd is free software; you can redistribute it and/or modify it
8 # under the terms of the GNU Lesser General Public License as published by
9 # the Free Software Foundation; either version 2.1 of the License, or
10 # (at your option) any later version.
12 # systemd is distributed in the hope that it will be useful, but
13 # WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 # General Public License for more details.
17 # You should have received a copy of the GNU Lesser General Public License
18 # along with systemd; If not, see <http://www.gnu.org/licenses/>.
21 local w word=$1; shift
23 [[ $w = "$word" ]] && return
29 loginctl list-users --no-legend --no-pager | { while read a b; do echo " $b"; done; };
34 systemctl list-units -t slice --no-legend --no-pager | { while read a b; do echo " $a"; done; };
38 local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]}
42 [STANDALONE]='-h --help --version --private-network -b --boot --read-only -q --quiet --share-system --keep-unit --network-veth -j'
43 [ARG]='-D --directory -u --user --uuid --capability --drop-capability --link-journal --bind --bind-ro -M --machine
44 -S --slice --setenv -Z --selinux-context -L --selinux-apifs-context --register --network-interface --network-bridge
48 _init_completion || return
50 if __contains_word "$prev" ${OPTS[ARG]}; then
53 comps=$(compgen -A directory -- "$cur" )
56 comps=$( __get_users )
62 comps='CAP_BLOCK_SUSPEND CAP_IPC_LOCK CAP_MAC_ADMIN CAP_MAC_OVERRIDE CAP_SYS_MODULE CAP_SYS_PACCT CAP_SYS_RAWIO
63 CAP_SYS_TIME CAP_SYSLOG CAP_WAKE_ALARM CAP_NET_ADMIN'
66 comps='CAP_AUDIT_CONTROL CAP_AUDIT_WRITE CAP_CHOWN CAP_DAC_OVERRIDE CAP_DAC_READ_SEARCH CAP_FOWNER CAP_FSETID
67 CAP_IPC_OWNER CAP_KILL CAP_LEASE CAP_LINUX_IMMUTABLE CAP_MKNOD CAP_NET_ADMIN CAP_NET_BIND_SERVICE
68 CAP_NET_BROADCAST CAP_NET_RAW CAP_SETFCAP CAP_SETGID CAP_SETPCAP CAP_SETUID CAP_SYS_ADMIN CAP_SYS_BOOT
69 CAP_SYS_CHROOT CAP_SYS_NICE CAP_SYS_PTRACE CAP_SYS_RESOURCE CAP_SYS_TTY_CONFIG'
72 comps='no auto guest host'
81 comps=$( __get_slices )
89 --selinux-apifs-context|-L)
105 COMPREPLY=( $(compgen -W '$comps' -- "$cur") )
109 COMPREPLY=( $(compgen -W '${OPTS[*]}' -- "$cur") )
112 complete -F _systemd_nspawn systemd-nspawn