diff options
author | Daniel Baumann <daniel.baumann@open-infrastructure.net> | 2016-06-18 06:04:04 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@open-infrastructure.net> | 2016-07-01 09:30:49 +0000 |
commit | adfa13b72da447414fe72a18e459769bb23689a9 (patch) | |
tree | e1a58f5534f2008fa73f9db71205c2190e2810bc /share | |
parent | Updating bash-completion for container remove command. (diff) | |
download | compute-tools-adfa13b72da447414fe72a18e459769bb23689a9.tar.xz compute-tools-adfa13b72da447414fe72a18e459769bb23689a9.zip |
Using tabs instead of spaces for indentation in container bash-completion.
Signed-off-by: Daniel Baumann <daniel.baumann@open-infrastructure.net>
Diffstat (limited to 'share')
-rw-r--r-- | share/bash-completion/container | 439 |
1 files changed, 220 insertions, 219 deletions
diff --git a/share/bash-completion/container b/share/bash-completion/container index 2b390f4..43a178e 100644 --- a/share/bash-completion/container +++ b/share/bash-completion/container @@ -16,225 +16,226 @@ _container() { - local cur prev cmd opts - COMPREPLY=() - cur="${COMP_WORDS[COMP_CWORD]}" - prev="${COMP_WORDS[COMP_CWORD-1]}" - - if [ ${COMP_CWORD} -gt 0 ] - then - cmd="${COMP_WORDS[1]}" - fi - - if [ "${prev}" = "--" ] - then - compopt -o bashdefault - COMPREPLY=( $(compgen -c -- $cur) ) - return 0 - fi - - case "${cmd}" in - console) - case "${cur}" in - -*) - opts="-n --name" - COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) - return 0 - ;; - - *) - case "${prev}" in - -n|--name) - opts=$(container list -s -f short) - COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) - return 0 - ;; - esac - ;; - esac - ;; - - create) - case "${cur}" in - -*) - opts="-n --name -c --capability -d --drop-capability -s --script -b --bind" - 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="debootstrap debconf default" - COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) - return 0 - ;; - esac - ;; - esac - ;; - - enter) - case "${cur}" in - -*) - opts="-n --name" - COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) - return 0 - ;; - - *) - case "${prev}" in - -n|--name) - opts=$(container list -s -f short) - COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) - return 0 - ;; - esac - ;; - 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" - COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) - return 0 - ;; - - *) - case "${prev}" in - -n|--name) - opts=$(container list -a -f short) - COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) - return 0 - ;; - esac - ;; - esac - ;; - - list) - case "${cur}" in - -*) - opts="-a --all -f --format -h --host -o --other -s --started -t --stopped" - 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="short full" - COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) - return 0 - ;; - esac - ;; - esac - ;; - - remove) - case "${cur}" in - -*) - opts="-n --name -f --force" - COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) - return 0 - ;; - - *) - case "${prev}" in - -n|--name) - opts=$(container list -t -f short) - COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) - return 0 - ;; - esac - ;; - esac - ;; - - restart) - case "${cur}" in - -*) - opts="-n --name" - COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) - return 0 - ;; - - *) - case "${prev}" in - -n|--name) - opts=$(container list -s -f short) - COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) - return 0 - ;; - esac - ;; - esac - ;; - - start) - case "${cur}" in - -*) - opts="-n --name" - COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) - return 0 - ;; - - *) - case "${prev}" in - -n|--name) - opts=$(container list -t -f short) - COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) - return 0 - ;; - esac - ;; - esac - ;; - - stop) - case "${cur}" in - -*) - opts="-n --name -f --force" - COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) - return 0 - ;; - - *) - case "${prev}" in - -n|--name) - opts=$(container list -s -f short) - COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) - return 0 - ;; - esac - ;; - esac - ;; - - *) - local commands=$(ls /usr/lib/container-tools/container/) - COMPREPLY=( $(compgen -W "${commands}" -- ${cur}) ) - return 0 - ;; - esac - - compopt -o filenames - COMPREPLY=( $(compgen -f -- $cur) ) - return 0 + local cur prev cmd opts + COMPREPLY=() + cur="${COMP_WORDS[COMP_CWORD]}" + prev="${COMP_WORDS[COMP_CWORD-1]}" + + if [ ${COMP_CWORD} -gt 0 ] + then + cmd="${COMP_WORDS[1]}" + fi + + if [ "${prev}" = "--" ] + then + compopt -o bashdefault + COMPREPLY=( $(compgen -c -- $cur) ) + return 0 + fi + + case "${cmd}" in + console) + case "${cur}" in + -*) + opts="-n --name" + COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) + return 0 + ;; + + *) + case "${prev}" in + -n|--name) + opts=$(container list -s -f short) + COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) + return 0 + ;; + esac + ;; + esac + ;; + + create) + case "${cur}" in + -*) + opts="-n --name -c --capability -d --drop-capability -s --script -b --bind" + 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="debootstrap debconf default" + COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) + return 0 + ;; + esac + ;; + esac + ;; + + enter) + case "${cur}" in + -*) + opts="-n --name" + COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) + return 0 + ;; + + *) + case "${prev}" in + -n|--name) + opts=$(container list -s -f short) + COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) + return 0 + ;; + esac + ;; + 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" + COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) + return 0 + ;; + + *) + case "${prev}" in + -n|--name) + opts=$(container list -a -f short) + COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) + return 0 + ;; + esac + ;; + esac + ;; + + list) + case "${cur}" in + -*) + opts="-a --all -f --format -h --host -o --other -s --started -t --stopped" + 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="short full" + COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) + return 0 + ;; + esac + ;; + esac + ;; + + remove) + case "${cur}" in + -*) + opts="-n --name -f --force" + COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) + return 0 + ;; + + *) + case "${prev}" in + -n|--name) + opts=$(container list -t -f short) + COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) + return 0 + ;; + esac + ;; + esac + ;; + + restart) + case "${cur}" in + -*) + opts="-n --name" + COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) + return 0 + ;; + + *) + case "${prev}" in + -n|--name) + opts=$(container list -s -f short) + COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) + return 0 + ;; + esac + ;; + esac + ;; + + start) + case "${cur}" in + -*) + opts="-n --name" + COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) + return 0 + ;; + + *) + case "${prev}" in + -n|--name) + opts=$(container list -t -f short) + COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) + return 0 + ;; + esac + ;; + esac + ;; + + stop) + case "${cur}" in + -*) + opts="-n --name -f --force" + COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) + return 0 + ;; + + *) + case "${prev}" in + -n|--name) + opts=$(container list -s -f short) + COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) + return 0 + ;; + esac + ;; + esac + ;; + + *) + local commands=$(ls /usr/lib/container-tools/container/) + COMPREPLY=( $(compgen -W "${commands}" -- ${cur}) ) + return 0 + ;; + esac + + compopt -o filenames + COMPREPLY=( $(compgen -f -- $cur) ) + return 0 } complete -F _container container cnt |