Add Bash completion for abra recipe ..

This commit is contained in:
3wc 2021-05-30 14:33:57 +02:00
parent cf2ae05dfd
commit 8c93d1ae88

View File

@ -38,6 +38,22 @@ _abra_complete_apps()
mapfile -t COMPREPLY < <(compgen -W "$(_abra_apps)" -- "$1")
}
_abra_recipes()
{
shopt -s nullglob dotglob
local RECIPES=(~/.abra/apps/*)
shopt -u nullglob dotglob
for RECIPE in "${RECIPES[@]}"; do
_abra_basename "${RECIPE%.env}"
done
}
_abra_complete_recipes()
{
mapfile -t COMPREPLY < <(compgen -W "$(_abra_recipes)" -- "$1")
}
_abra_complete()
{
compopt +o default +o nospace
@ -46,6 +62,7 @@ _abra_complete()
local -r cmds='
app
server
recipe
'
local -r short_opts='-e -h -s -v'
local -r long_opts='--env --help --stack --version'
@ -101,6 +118,12 @@ _abra_complete()
_abra_complete_apps "$cur"
fi
;;
recipe)
# Offer exactly one app completion.
if (( COMP_CWORD == cmd_index + 1 )); then
_abra_complete_recipes "$cur"
fi
;;
#help)
# # Offer exactly one command name completion.
# if (( COMP_CWORD == cmd_index + 1 )); then