client: docker: add exec wrapper, update completion
This commit is contained in:
@@ -46,7 +46,7 @@ function docker-finance::completion()
|
|||||||
mapfile -t _images < <(docker images --format "{{.Repository}}:{{.Tag}}" --filter=reference='docker-finance/*/*:*' | cut -d'/' -f2- | grep $USER)
|
mapfile -t _images < <(docker images --format "{{.Repository}}:{{.Tag}}" --filter=reference='docker-finance/*/*:*' | cut -d'/' -f2- | grep $USER)
|
||||||
declare -r _images
|
declare -r _images
|
||||||
|
|
||||||
local -r _commands=("gen" "edit" "build" "update" "backup" "rm" "up" "down" "start" "stop" "run" "shell" "version" "license" "linter" "doxygen" "plugins")
|
local -r _commands=("gen" "edit" "build" "update" "backup" "rm" "up" "down" "start" "stop" "run" "shell" "exec" "version" "license" "linter" "doxygen" "plugins")
|
||||||
|
|
||||||
local _reply
|
local _reply
|
||||||
|
|
||||||
@@ -86,7 +86,7 @@ function docker-finance::completion()
|
|||||||
update)
|
update)
|
||||||
mapfile -t _reply < <(compgen -W "help type${global_arg_delim_2}" -- "$_cur")
|
mapfile -t _reply < <(compgen -W "help type${global_arg_delim_2}" -- "$_cur")
|
||||||
;;
|
;;
|
||||||
backup | rm | up | down | start | stop)
|
backup | rm | up | down | start | stop | exec)
|
||||||
# TODO: _currently no-op
|
# TODO: _currently no-op
|
||||||
;;
|
;;
|
||||||
shell)
|
shell)
|
||||||
|
|||||||
@@ -77,6 +77,7 @@ function main()
|
|||||||
|
|
||||||
run \e[34;3mSpawn docker-finance container with given command (container removed on exit)\e[0m
|
run \e[34;3mSpawn docker-finance container with given command (container removed on exit)\e[0m
|
||||||
shell \e[34;3mOpen shell into running docker-finance container\e[0m
|
shell \e[34;3mOpen shell into running docker-finance container\e[0m
|
||||||
|
exec \e[34;3mExecute command within running docker-finance container\e[0m
|
||||||
|
|
||||||
plugins \e[34;3mExecute a client-side categorical docker-finance plugin ('repo' or 'custom')\e[0m
|
plugins \e[34;3mExecute a client-side categorical docker-finance plugin ('repo' or 'custom')\e[0m
|
||||||
version \e[34;3mPrint current version of docker-finance and its dependencies\e[0m
|
version \e[34;3mPrint current version of docker-finance and its dependencies\e[0m
|
||||||
@@ -203,6 +204,9 @@ function main()
|
|||||||
shell)
|
shell)
|
||||||
lib_docker::shell "${@:3}"
|
lib_docker::shell "${@:3}"
|
||||||
;;
|
;;
|
||||||
|
exec)
|
||||||
|
lib_docker::exec "${@:3}"
|
||||||
|
;;
|
||||||
backup)
|
backup)
|
||||||
lib_docker::backup "${@:3}"
|
lib_docker::backup "${@:3}"
|
||||||
;;
|
;;
|
||||||
|
|||||||
@@ -505,6 +505,11 @@ function lib_docker::__shell()
|
|||||||
docker exec -it --user "$global_arg_user" --workdir / "$global_container" /bin/bash
|
docker exec -it --user "$global_arg_user" --workdir / "$global_container" /bin/bash
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function lib_docker::__exec()
|
||||||
|
{
|
||||||
|
docker exec -it "$global_container" /bin/bash -i -c "$@"
|
||||||
|
}
|
||||||
|
|
||||||
function lib_docker::__parse_args_edit()
|
function lib_docker::__parse_args_edit()
|
||||||
{
|
{
|
||||||
[ -z "$global_usage" ] && lib_utils::die_fatal
|
[ -z "$global_usage" ] && lib_utils::die_fatal
|
||||||
|
|||||||
@@ -218,6 +218,16 @@ function lib_docker::shell()
|
|||||||
lib_utils::catch $?
|
lib_utils::catch $?
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#
|
||||||
|
# Execute command within a running docker-finance container
|
||||||
|
#
|
||||||
|
|
||||||
|
function lib_docker::exec()
|
||||||
|
{
|
||||||
|
lib_docker::__exec "$@"
|
||||||
|
lib_utils::catch $?
|
||||||
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
# Edit client configuration of given docker-finance instance
|
# Edit client configuration of given docker-finance instance
|
||||||
#
|
#
|
||||||
|
|||||||
Reference in New Issue
Block a user