Sha256: bdc1cbec1b0b131f42e8c6df06a45bfa8177afeb09d802db40a5d7376e921e52
Contents?: true
Size: 1.44 KB
Versions: 1
Compression:
Stored size: 1.44 KB
Contents
#!/bin/bash # cloudstack-cli # https://github.com/niwo/cloudstack-cli # # Copyright (c) 2014 Nik Wolfgramm # Licensed under the MIT license. # https://raw.github.com/niwo/cloudstack-cli/master/LICENSE.txt # Usage: # # To enable bash <tab> completion for cloudstack-cli, add the following line (minus the # leading #, which is the bash comment character) to your ~/.bash_profile file (use ~/.bashrc on Ubuntu): # # eval "$(cs completion --shell=bash)" _cs() { COMPREPLY=() local word="${COMP_WORDS[COMP_CWORD]}" # list available base commands if [ "$COMP_CWORD" -eq 1 ]; then COMPREPLY=( $(compgen -W "$(cs help | grep cs | cut -d ' ' -f4)" -- "$word") ) else local words=("${COMP_WORDS[@]}") # ignore commands which contain 'help' if [[ "${words[@]}" == *help* ]]; then COMPREPLY=( $(compgen -W '' -- "$word") ) # search for subcommand elif [[ "$word" != -* ]] && [ "$COMP_CWORD" -eq 2 ]; then local cp1=$(echo ${words[@]} | cut -d ' ' -f1-2) COMPREPLY=( $(compgen -W "$($cp1 help | grep cs | cut -d ' ' -f5)" -- "$word") ) # list options for the subcommand elif [[ "$word" =~ -* ]] && [ "$COMP_CWORD" -gt 2 ]; then local cp1=$(echo ${words[@]} | cut -d ' ' -f1-2) local cp2=$(echo ${words[@]} | cut -d ' ' -f3) local cp3=$($cp1 help $cp2 2>/dev/null) COMPREPLY=( $(compgen -W "$(echo $cp3 | awk 'NR>1{print $1}' RS=[ FS='\=') 2>/dev/null" -- "$word") ) fi fi } complete -F _cs cs
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
cloudstack-cli-0.8.2 | completions/cs.bash |