Skip to content

Commit

Permalink
[jjo] fix ":" completion for e.g.: juju ssh -m myctrl:d<TAB>>
Browse files Browse the repository at this point in the history
  • Loading branch information
jjo committed Jun 17, 2016
1 parent 12ab89d commit 2c9da42
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions etc/bash_completion.d/juju-2.0
Original file line number Diff line number Diff line change
Expand Up @@ -131,10 +131,14 @@ _juju_2_0_completion_func_for_cmd() {
fi
# parse 1st line of juju help <cmd>, to guess the completion function
local prev_word=${COMP_WORDS[cword-1]}
case ${COMP_WORDS[cword]} in
# special case for ':', prev_word is one place behind, needed for eg
# juju status --model local.foo:<tab>
:) prev_word=${COMP_WORDS[cword-2]};;
case ${prev_word} in
# special case for eg:
# juju ssh -m myctrl:f<TAB>
# ->
# COMP_WORDS[cword-1] is ':' ($prev_word)
# COMP_WORDS[cword-2] is 'myctrl'
# COMP_WORDS[cword-3] is '-m'
:) prev_word=${COMP_WORDS[cword-3]};;
esac
case "${prev_word}" in
--model|-m) echo _juju_2_0_list_controllers_models_noflags; return 0;;
Expand Down

0 comments on commit 2c9da42

Please sign in to comment.