From bbf96b0cc29ba308a831344d107eee4e2dacc588 Mon Sep 17 00:00:00 2001 From: Aaron Fiore Date: Wed, 7 Aug 2024 23:30:27 -0700 Subject: [PATCH] container: bash: completion: add plugins support --- container/src/finance/completion.bash | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/container/src/finance/completion.bash b/container/src/finance/completion.bash index 0678b31..34d1106 100644 --- a/container/src/finance/completion.bash +++ b/container/src/finance/completion.bash @@ -28,7 +28,7 @@ function docker-finance::completion() mapfile -t _profiles < <(pushd "${DOCKER_FINANCE_CONTAINER_FLOW}"/profiles &>/dev/null && ls -d */*) declare -r _profiles - local -r _commands=("all" "edit" "fetch" "import" "ledger" "ledger-ui" "ledger-web" "meta" "reports" "root" "taxes") + local -r _commands=("all" "edit" "fetch" "import" "ledger" "ledger-ui" "ledger-web" "meta" "plugins" "reports" "root" "taxes") local _reply @@ -76,6 +76,12 @@ function docker-finance::completion() # NOTE: args are dependent upon metadata contents mapfile -t _reply < <(compgen -W "help" -- "$_cur") ;; + plugins) + local _plugins + mapfile -t _plugins < <(find "${DOCKER_FINANCE_CONTAINER_FLOW}"/plugins -type f -executable -printf '%P\n' 2>/dev/null) + declare -r _plugins + mapfile -t _reply < <(compgen -W "${_plugins[*]}" -- "$_cur") + ;; reports) mapfile -t _reply < <(compgen -W "help all${global_arg_delim_2} type${global_arg_delim_2} interval${global_arg_delim_2} year${global_arg_delim_2}" -- "$_cur") ;;