Skip to content

Commit

Permalink
added first milxc-autocomplete.bash to autocomplete commandline
Browse files Browse the repository at this point in the history
  • Loading branch information
Francois Lesueur committed Feb 9, 2020
1 parent 7d8b6c5 commit e1e4741
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions milxc-completion.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#/usr/bin/env bash

_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 "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]}"))
fi


}

complete -F _milxc_completions mi-lxc.py

0 comments on commit e1e4741

Please sign in to comment.