aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2018-12-14 03:13:30 +0900
committerYu Watanabe <watanabe.yu+github@gmail.com>2018-12-14 03:18:33 +0900
commitff1cf894d2c095e654e05c1d8e9f6f04de1c1e41 (patch)
tree837cd9567c0a51adf66c18cb8647ed53a909bb6d /shell-completion/bash
parentbash-completion: run: support recently added options (diff)
downloadsystemd-ff1cf894d2c095e654e05c1d8e9f6f04de1c1e41.tar.gz
systemd-ff1cf894d2c095e654e05c1d8e9f6f04de1c1e41.tar.bz2
systemd-ff1cf894d2c095e654e05c1d8e9f6f04de1c1e41.zip
bash-completion: nspawn: support recently added options
Diffstat (limited to 'shell-completion/bash')
-rw-r--r--shell-completion/bash/systemd-nspawn35
1 files changed, 32 insertions, 3 deletions
diff --git a/shell-completion/bash/systemd-nspawn b/shell-completion/bash/systemd-nspawn
index 2ff39b65d..62bb0ba60 100644
--- a/shell-completion/bash/systemd-nspawn
+++ b/shell-completion/bash/systemd-nspawn
@@ -44,13 +44,20 @@ __get_env() {
env | { while read a; do echo " ${a%%=*}"; done; };
}
-__get_interfaces(){
+__get_interfaces() {
{ cd /sys/class/net && echo *; } | \
while read -d' ' -r name; do
[[ "$name" != "lo" ]] && echo "$name"
done
}
+__get_rlimit() {
+ local i
+ for i in $(systemd-nspawn --rlimit=help 2>/dev/null); do
+ echo " ${i}="
+ done
+}
+
_systemd_nspawn() {
local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]}
local i verb comps
@@ -62,7 +69,8 @@ _systemd_nspawn() {
-S --slice -E --setenv -Z --selinux-context -L --selinux-apifs-context --register --network-interface --network-bridge
--personality -i --image --tmpfs --volatile --network-macvlan --kill-signal --template --notify-ready --root-hash
--chdir --pivot-root --property --private-users --network-namespace-path --network-ipvlan --network-veth-extra
- --network-zone -p --port --system-call-filter --overlay --overlay-ro --settings'
+ --network-zone -p --port --system-call-filter --overlay --overlay-ro --settings
+ --rlimit --hostname --no-new-privileges --oom-score-adjust --cpu-affinity --resolv-conf --timezone'
)
_init_completion || return
@@ -131,7 +139,7 @@ _systemd_nspawn() {
comps='x86 x86-64'
;;
--volatile)
- comps='yes state no'
+ comps=$( systemd-nspawn --volatile=help 2>/dev/null )
;;
--image|-i)
compopt -o nospace
@@ -153,6 +161,27 @@ _systemd_nspawn() {
--settings)
comps='yes no override trusted'
;;
+ --rlimit)
+ comps=$( __get_rlimit )
+ ;;
+ --hostname)
+ comps=''
+ ;;
+ --no-new-privileges)
+ comps='yes no'
+ ;;
+ --oom-score-adjust)
+ comps=''
+ ;;
+ --cpu-affinity)
+ comps=''
+ ;;
+ --resolv-conf)
+ comps=$( systemd-nspawn --resolv-conf=help 2>/dev/null )
+ ;;
+ --timezone)
+ comps=$( systemd-nspawn --timezone=help 2>/dev/null )
+ ;;
esac
COMPREPLY=( $(compgen -W '$comps' -- "$cur") )
return 0