From e81986238b9faadd633c22883bd4aa6152111c00 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 4 Jan 2017 11:41:54 +0100 Subject: Merging upstream version 20170101. Signed-off-by: Daniel Baumann --- share/bash-completion/container | 208 +++++++++++++++++++--------------------- 1 file changed, 97 insertions(+), 111 deletions(-) (limited to 'share/bash-completion/container') diff --git a/share/bash-completion/container b/share/bash-completion/container index 8d54ba4..0bc22c0 100644 --- a/share/bash-completion/container +++ b/share/bash-completion/container @@ -36,218 +36,204 @@ _container() fi case "${cmd}" in + auto) + opts="-f --force -s --start -t --stop" + COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) + return 0 + ;; + console) - case "${cur}" in - -*) - opts="-n --name" + case "${prev}" in + -n|--name) + opts=$(container list -s -f shell) COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) return 0 ;; *) - case "${prev}" in - -n|--name) - opts=$(container list -s -f shell) - COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) - return 0 - ;; - esac + opts="-n --name" + COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) + return 0 ;; esac ;; create) - case "${cur}" in - -*) - opts="-n --name -c --capability -d --drop-capability -s --script -b --bind" + case "${prev}" in + -n|--name) + opts=$(cd /etc/container-tools/debconf 2>/dev/null && ls *.cfg 2>/dev/null | sed -e 's/.cfg$//g') + COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) + return 0 + ;; + + -s|--script) + opts=$(cd /usr/share/container-tools/scripts && find -maxdepth 1 -not -type d -and -not -name 'default' -and -not -name 'debconf' -and -not -name '*.d' -printf '%P\n' | sort) COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) return 0 ;; *) - case "${prev}" in - -n|--name) - opts=$(cd /srv/container/container-tools/debconf 2>/dev/null && ls *.cfg 2>/dev/null | sed -e 's/.cfg$//g') - COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) - return 0 - ;; - - -s|--script) - opts=$(cd /usr/share/container-tools/scripts && find -maxdepth 1 -not -type d -and -not -name 'default' -and -not -name 'debconf' -and -not -name '*.d' -printf '%P\n' | sort) - COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) - return 0 - ;; - esac + opts="-n --name -c --capability -d --drop-capability -s --script -b --bind" + COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) + return 0 ;; esac ;; enter) - case "${cur}" in - -*) - opts="-n --name" + case "${prev}" in + -n|--name) + opts=$(container list -s -f shell) COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) return 0 ;; *) - case "${prev}" in - -n|--name) - opts=$(container list -s -f shell) - COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) - return 0 - ;; - esac + opts="-n --name" + COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) + return 0 ;; esac ;; limit) - case "${cur}" in - -*) - opts="-n --name --blockio-device-weight --blockio-read-bandwith -b --blockio-weight --blockio-write-bandwith -c --cpu-quota --cpu-shares -m --memory-limit -t --tasks-max" + case "${prev}" in + -n|--name) + opts=$(container list -a -f shell) COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) return 0 ;; *) - case "${prev}" in - -n|--name) - opts=$(container list -a -f shell) - COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) - return 0 - ;; - esac + opts="-n --name --blockio-device-weight --blockio-read-bandwith -b --blockio-weight --blockio-write-bandwith -c --cpu-quota --cpu-shares -m --memory-limit -t --tasks-max" + COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) + return 0 ;; esac ;; list|ls) - case "${cur}" in - -*) + case "${prev}" in + -h|--host) + opts="true false $(hostname -f)" + COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) + return 0 + ;; + + -f|--format) + opts="cli csv json nwdiag shell yaml xml" + COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) + return 0 + ;; + + *) opts="-a --all -f --format -h --host -o --other -s --started -t --stopped" COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) return 0 ;; + esac + ;; + + move|mv) + case "${prev}" in + -o|--old) + opts=$(container list -t -f shell) + COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) + return 0 + ;; *) - case "${prev}" in - -h|--host) - opts="true false $(hostname -f)" - COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) - return 0 - ;; - - -f|--format) - opts="cli csv json nwdiag shell yaml xml" - COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) - return 0 - ;; - esac + opts="-f --force -n --new -o --old" + COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) + return 0 ;; esac ;; remove|rm) - case "${cur}" in - -*) - opts="-n --name -f --force" + case "${prev}" in + -n|--name) + opts=$(container list -t -f shell) COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) return 0 ;; *) - case "${prev}" in - -n|--name) - opts=$(container list -t -f shell) - COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) - return 0 - ;; - esac + opts="-n --name -f --force" + COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) + return 0 ;; esac ;; restart) - case "${cur}" in - -*) - opts="-n --name" + case "${prev}" in + -n|--name) + opts=$(container list -s -f shell) COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) return 0 ;; *) - case "${prev}" in - -n|--name) - opts=$(container list -s -f shell) - COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) - return 0 - ;; - esac + opts="-n --name" + COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) + return 0 ;; esac ;; start) - case "${cur}" in - -*) - opts="-n --name" + case "${prev}" in + -n|--name) + opts=$(container list -t -f shell) COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) return 0 ;; *) - case "${prev}" in - -n|--name) - opts=$(container list -t -f shell) - COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) - return 0 - ;; - esac + opts="-n --name" + COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) + return 0 ;; esac ;; status) - case "${cur}" in - -*) - opts="-n --name" + case "${prev}" in + -n|--name) + opts=$(container list -t -f shell) COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) return 0 ;; *) - case "${prev}" in - -n|--name) - opts=$(container list -t -f shell) - COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) - return 0 - ;; - esac + opts="-n --name" + COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) + return 0 ;; esac ;; stop) - case "${cur}" in - -*) - opts="-n --name -f --force" + case "${prev}" in + -n|--name) + opts=$(container list -s -f shell) COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) return 0 ;; *) - case "${prev}" in - -n|--name) - opts=$(container list -s -f shell) - COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) - return 0 - ;; - esac + opts="-n --name -f --force" + COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) + return 0 ;; esac ;; + version) + return 0 + ;; + *) local commands=$(cd /usr/lib/container-tools/container 2>/dev/null && find * -type f -print) COMPREPLY=( $(compgen -W "${commands}" -- ${cur}) ) -- cgit v1.2.3