You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Mar 13, 2022. It is now read-only.
Here's my version. I've adapted it from nova.bash_completion by changing the function name and command from nova to supernova and adding line 24 and adjusting line 25 to append the sections from ~/.supernova to _nova_opts: i.e. " grep "[.*]" ~/.supernova | sed "s/[//" | sed "s/]//" > ~/.novaclient/environments" and "_nova_opts="$_nova_opts "$(cat ~/.novaclient/environments 2> /dev/null | tr '\n' ' ')"
_nova_opts="" # lazy init
_nova_flags="" # lazy init
_nova_opts_exp="" # lazy init
_supernova()
{
local cur prev nbc cflags
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
if [ "x$_nova_opts" == "x" ] ; then
nbc="`nova bash-completion | sed -e "s/[ ]+/ /"`"
_nova_opts="`echo "$nbc" | sed -e "s/--[a-z0-9_-]*//g" -e "s/[ ]+/ /g"`"
_nova_flags="`echo " $nbc" | sed -e "s/ [^-][^-][a-z0-9_-]*//g" -e "s/[ ]+/ /g"`"
_nova_opts_exp="`echo "$_nova_opts" | sed -e "s/[ ]/|/g"`"
fi
if [[ " ${COMP_WORDS[@]} " =~ " "($_nova_opts_exp)" " && "$prev" != "help" ]] ; then
COMPLETION_CACHE=~/.novaclient/*/*-cache
cflags="$_nova_flags "$(cat $COMPLETION_CACHE 2> /dev/null | tr '\n' ' ')
COMPREPLY=($(compgen -W "${cflags}" -- ${cur}))
else
grep "\[.*\]" ~/.supernova | sed "s/\[//" | sed "s/\]//" > ~/.novaclient/environments
_nova_opts="$_nova_opts "$(cat ~/.novaclient/environments 2> /dev/null | tr '\n' ' ')
COMPREPLY=($(compgen -W "${_nova_opts}" -- ${cur}))
fi
return 0
}
complete -F _supernova supernova
python-novaclient has a bash completion script that I can modify to use with supernova:
https://github.com/openstack/python-novaclient/blob/master/tools/nova.bash_completion
It would be cool if supernova provided that AND added the environment names from the ~/.supernova file to the completion cache.
The text was updated successfully, but these errors were encountered: