Skip to content

Commit

Permalink
updated usage output for better autocompletion
Browse files Browse the repository at this point in the history
  • Loading branch information
Francois Lesueur committed Feb 9, 2020
1 parent e1e4741 commit 387c469
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion mi-lxc.py
Original file line number Diff line number Diff line change
Expand Up @@ -568,7 +568,7 @@ def printgraph():

def usage():
print(
"No argument given, usage with create, renet, destroy, destroymaster, updatemaster, start, stop, attach [user@]<name> [command], display [user@]<name>, print.\nNames are ", end='')
"No argument given, usage with: create, renet, destroy, destroymaster, updatemaster, start, stop, attach [user@]<name> [command], display [user@]<name>, print.\nNames are: ", end='')
print(listContainers())

def listContainers():
Expand Down
4 changes: 2 additions & 2 deletions milxc-completion.bash
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
_milxc_completions()
{
if [ "${#COMP_WORDS[@]}" == "2" ]; then
COMPREPLY=($(compgen -W "$(./mi-lxc.py | grep usage | cut -d' ' -f 6- | sed 's/[,.]/ /g' | sed 's/\[[a-z@]*\]//g' | sed 's/<[a-z]*>//g')" "${COMP_WORDS[1]}"))
COMPREPLY=($(compgen -W "$(./mi-lxc.py | grep usage | cut -d':' -f 2 | sed 's/[,.]/ /g' | sed 's/\[[a-z@]*\]//g' | sed 's/<[a-z]*>//g')" "${COMP_WORDS[1]}"))
# COMPREPLY=($(compgen -W "create renet destroy destroymaster updatemaster start stop attach display print" "${COMP_WORDS[1]}"))
# ./mi-lxc.py | grep usage | cut -d' ' -f 6- | sed 's/, / /g' | sed 's/\[[a-z@]*\]//g' | sed 's/<[a-z]*>//g'
fi

if [ "${#COMP_WORDS[@]}" == "3" ]; then
COMPREPLY=($(compgen -W "$(./mi-lxc.py | grep Names | cut -d' ' -f 3- | sed 's/, / /g')" "${COMP_WORDS[2]}"))
COMPREPLY=($(compgen -W "$(./mi-lxc.py | grep Names | cut -d':' -f 2 | sed 's/, / /g')" "${COMP_WORDS[2]}"))
fi


Expand Down

0 comments on commit 387c469

Please sign in to comment.