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:
@@ -101,6 +101,9 @@ function docker-finance::completion()
|
||||
mapfile -t _reply < <(compgen -W "help gen${global_arg_delim_2} rm${global_arg_delim_2}" -- "$_cur")
|
||||
;;
|
||||
plugins)
|
||||
# Re-enable space after completion (for plugin args)
|
||||
compopt +o nospace
|
||||
|
||||
# TODO: HACK: since this is completion, lib_docker is never initialized, prior to completing
|
||||
# (environment variables are needed).
|
||||
if [ -z "$DOCKER_FINANCE_CLIENT_REPO" ]; then
|
||||
@@ -117,10 +120,11 @@ function docker-finance::completion()
|
||||
fi
|
||||
[ -z "$DOCKER_FINANCE_CLIENT_PLUGINS" ] && lib_utils::print_fatal "DOCKER_FINANCE_CLIENT_PLUGINS not set"
|
||||
|
||||
local -r _args=("-type" "f" "-executable" "-not" "-path" "*/internal/*" "-not" "-path" "*/impl/*")
|
||||
local _plugins
|
||||
mapfile -t _plugins < <({
|
||||
find "${DOCKER_FINANCE_CLIENT_PLUGINS}"/client/docker -type f -executable -printf 'custom/%P\n' 2>/dev/null
|
||||
find "${DOCKER_FINANCE_CLIENT_REPO}"/client/plugins/docker -type f -executable -printf 'repo/%P\n' 2>/dev/null
|
||||
find "${DOCKER_FINANCE_CLIENT_PLUGINS}"/client/docker "${_args[@]}" -printf 'custom/%P\n' 2>/dev/null
|
||||
find "${DOCKER_FINANCE_CLIENT_REPO}"/client/plugins/docker "${_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