sqn-completion - also complete available profiles (-p)
This commit is contained in:
@@ -13,9 +13,9 @@ _sqn_completions()
|
|||||||
curCmd="${curCmd%\"\'*}"
|
curCmd="${curCmd%\"\'*}"
|
||||||
COMPREPLY=()
|
COMPREPLY=()
|
||||||
case "$cur" in
|
case "$cur" in
|
||||||
-*)
|
-*|+*)
|
||||||
opts=( \
|
opts=( \
|
||||||
-- \
|
-- ++\
|
||||||
-a --all \
|
-a --all \
|
||||||
-c --config \
|
-c --config \
|
||||||
-d --dry-run \
|
-d --dry-run \
|
||||||
@@ -31,10 +31,29 @@ _sqn_completions()
|
|||||||
--version)
|
--version)
|
||||||
read -r -d '' -a COMPREPLY < <(compgen -W "${opts[*]}" -- "$cur");;
|
read -r -d '' -a COMPREPLY < <(compgen -W "${opts[*]}" -- "$cur");;
|
||||||
*)
|
*)
|
||||||
# Stop after step selection (last argument which is not an option; starting with "-")
|
case "${COMP_WORDS[((COMP_CWORD-1))]}" in
|
||||||
(( COMP_CWORD > 1 )) && [[ ! "${COMP_WORDS[((COMP_CWORD - 1))]}" =~ ^- ]] && return
|
# provide completion for option with parameter
|
||||||
# sequencer.sh provides creation of a step list with search functionality
|
-p|--profile)
|
||||||
read -r -a COMPREPLY <<<"$( "$curCmd" -ls "$cur" )";;
|
# sequencer.sh provides creation of a profile list with search functionality
|
||||||
|
read -r -a COMPREPLY <<<"$( "$curCmd" -pl "${cur}" )"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
# Stop after step selection (last argument which is not an option (starting with "-|+")
|
||||||
|
# or option paramter (profile name))
|
||||||
|
if (( COMP_CWORD > 1 )) && [[ ! "${COMP_WORDS[((COMP_CWORD - 1))]}" =~ ^(-|\+) ]] ; then
|
||||||
|
case "${COMP_WORDS[((COMP_CWORD - 2))]}" in
|
||||||
|
-p|--profile)
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
return
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
# sequencer.sh provides creation of a step list with search functionality
|
||||||
|
read -r -a COMPREPLY <<<"$( "$curCmd" -ls "$cur" )"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user