diff options
author | Daniel Baumann <mail@daniel-baumann.ch> | 2017-01-04 10:41:50 +0000 |
---|---|---|
committer | Daniel Baumann <mail@daniel-baumann.ch> | 2017-01-04 10:41:50 +0000 |
commit | 9c257ffef25f49b1ca6ac4b0eea325eecbec52c8 (patch) | |
tree | 6d20a6605f2d454f634212dd58f12a2535a8b6eb /share/bash-completion | |
parent | Adding upstream version 20161220. (diff) | |
download | open-infrastructure-compute-tools-9c257ffef25f49b1ca6ac4b0eea325eecbec52c8.tar.xz open-infrastructure-compute-tools-9c257ffef25f49b1ca6ac4b0eea325eecbec52c8.zip |
Adding upstream version 20170101.upstream/20170101
Signed-off-by: Daniel Baumann <mail@daniel-baumann.ch>
Diffstat (limited to 'share/bash-completion')
-rw-r--r-- | share/bash-completion/container | 208 |
1 files changed, 97 insertions, 111 deletions
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}) ) |