forked from EvergreenCrypto/docker-finance
client/container: src: completion: plugins enhancements
- Re-enables space after completion for plugin arguments - Ignores internal/implementation files when completing * Files must be within an 'internal'/'impl' directory
This commit is contained in:
@@ -109,13 +109,17 @@ function docker-finance::completion()
|
||||
mapfile -t _reply < <(compgen -W "help" -- "$_cur")
|
||||
;;
|
||||
plugins)
|
||||
# Re-enable space after completion (for plugin args)
|
||||
compopt +o nospace
|
||||
|
||||
[ -z "$DOCKER_FINANCE_CONTAINER_REPO" ] && lib_utils::die_fatal
|
||||
[ -z "$DOCKER_FINANCE_CONTAINER_PLUGINS" ] && lib_utils::die_fatal
|
||||
|
||||
local -r _args=("-type" "f" "-executable" "-not" "-path" "*/internal/*" "-not" "-path" "*/impl/*")
|
||||
local _plugins
|
||||
mapfile -t _plugins < <({
|
||||
find "${DOCKER_FINANCE_CONTAINER_PLUGINS}"/finance -type f -executable -printf 'custom/%P\n' 2>/dev/null
|
||||
find "${DOCKER_FINANCE_CONTAINER_REPO}"/plugins/finance -type f -executable -printf 'repo/%P\n' 2>/dev/null
|
||||
find "${DOCKER_FINANCE_CONTAINER_PLUGINS}"/finance "${_args[@]}" -printf 'custom/%P\n' 2>/dev/null
|
||||
find "${DOCKER_FINANCE_CONTAINER_REPO}"/plugins/finance "${_args[@]}" -printf 'repo/%P\n' 2>/dev/null
|
||||
})
|
||||
declare -r _plugins
|
||||
mapfile -t _reply < <(compgen -W "${_plugins[*]}" -- "$_cur")
|
||||
|
||||
Reference in New Issue
Block a user