From 8eab0eb560d45ae54e055f511774262146d62652 Mon Sep 17 00:00:00 2001 From: Aaron Fiore Date: Wed, 26 Jun 2024 01:26:00 -0700 Subject: [PATCH] client: lib_docker: add `edit` option for custom Dockerfile --- client/src/docker/docker.bash | 2 +- client/src/docker/lib/internal/lib_docker.bash | 16 ++++++++++++---- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/client/src/docker/docker.bash b/client/src/docker/docker.bash index aa32242..f55eb04 100755 --- a/client/src/docker/docker.bash +++ b/client/src/docker/docker.bash @@ -55,7 +55,7 @@ function main() Environment (all platforms): gen \e[34;3mGenerate docker-finance environment\e[0m - edit \e[34;3mEdit existing client-side configuration file [arg]\e[0m + edit \e[34;3mEdit existing client-side configurations\e[0m All platforms: diff --git a/client/src/docker/lib/internal/lib_docker.bash b/client/src/docker/lib/internal/lib_docker.bash index db0a595..683ed42 100644 --- a/client/src/docker/lib/internal/lib_docker.bash +++ b/client/src/docker/lib/internal/lib_docker.bash @@ -233,7 +233,7 @@ function lib_docker::__edit() Configuration type: - type${global_arg_delim_2} + type${global_arg_delim_2} \e[32mExamples:\e[0m @@ -243,8 +243,11 @@ function lib_docker::__edit() \e[37;2m# Edit client/container shell (superscript) \e[0m $ $global_usage type${global_arg_delim_2}shell - \e[37;2m# Edit client/container shell (w/ alternate wording) and environment variables\e[0m - $ $global_usage type${global_arg_delim_2}superscript${global_arg_delim_3}env + \e[37;2m# Edit client's custom Dockerfile (appended to final Dockerfile) \e[0m + $ $global_usage type${global_arg_delim_2}build + + \e[37;2m# Previous commands with alternate wordings\e[0m + $ $global_usage type${global_arg_delim_2}superscript${global_arg_delim_3}dockerfile${global_arg_delim_3}env " if [ $# -ne 1 ]; then @@ -277,7 +280,7 @@ function lib_docker::__edit() read -ra _read <<<"$_arg_type" for _type in "${_read[@]}"; do - if [[ ! "$_type" =~ ^env$|^shell$|^superscript$ ]]; then + if [[ ! "$_type" =~ ^env$|^shell$|^superscript$|^build$|^dockerfile$ ]]; then lib_utils::die_usage "$_usage" fi done @@ -312,6 +315,11 @@ function lib_docker::__edit() _paths+=("$global_shell_file") ;; + build | dockerfile) + [ -z "$global_custom_dockerfile" ] && lib_utils::die_fatal + + _paths+=("$global_custom_dockerfile") + ;; esac done