container: bash: completion: add plugins support

This commit is contained in:
2024-08-07 23:30:27 -07:00
parent a4f9b401d3
commit bbf96b0cc2

View File

@@ -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")
;;