client/container: rename 'subprofile' script to 'subscript'
- Provides clarity, avoids confusion (subprofile.bash -> subscript.bash) - Changes filename in superscript source * End-user must update with client command `edit type=superscript` - Changes filename in flow subprofile's docker-finance.d * Pre-existing subprofiles must manually rename their subscript file
This commit is contained in:
@@ -74,7 +74,7 @@ function lib_gen::__parse_args()
|
||||
|
||||
Configuration type:
|
||||
|
||||
config${global_arg_delim_2}<fetch | hledger | meta | subprofile>
|
||||
config${global_arg_delim_2}<fetch | hledger | meta | subscript>
|
||||
|
||||
Accounts:
|
||||
|
||||
@@ -128,13 +128,13 @@ function lib_gen::__parse_args()
|
||||
$ $global_usage type${global_arg_delim_2}env${global_arg_delim_3}build${global_arg_delim_3}superscript${global_arg_delim_3}flow profile${global_arg_delim_2}parent${global_arg_delim_1}child confirm${global_arg_delim_2}false dev${global_arg_delim_2}true
|
||||
|
||||
\e[37;2m# Generate only the given configurations for 'parent/child'\e[0m
|
||||
$ $global_usage type${global_arg_delim_2}flow profile${global_arg_delim_2}parent${global_arg_delim_1}child config${global_arg_delim_2}fetch${global_arg_delim_3}hledger${global_arg_delim_3}meta${global_arg_delim_3}subprofile
|
||||
$ $global_usage type${global_arg_delim_2}flow profile${global_arg_delim_2}parent${global_arg_delim_1}child config${global_arg_delim_2}fetch${global_arg_delim_3}hledger${global_arg_delim_3}meta${global_arg_delim_3}subscript
|
||||
|
||||
\e[37;2m# Generate only the given accounts for 'parent/child'\e[0m
|
||||
$ $global_usage type${global_arg_delim_2}flow profile${global_arg_delim_2}parent${global_arg_delim_1}child account${global_arg_delim_2}capital-one${global_arg_delim_3}chase${global_arg_delim_3}coinbase
|
||||
|
||||
\e[37;2m# Generate the given configs and accounts for given 'parent/child'\e[0m
|
||||
$ $global_usage type${global_arg_delim_2}flow profile${global_arg_delim_2}parent${global_arg_delim_1}child config${global_arg_delim_2}meta${global_arg_delim_3}subprofile account${global_arg_delim_2}ethereum-based${global_arg_delim_3}metamask
|
||||
$ $global_usage type${global_arg_delim_2}flow profile${global_arg_delim_2}parent${global_arg_delim_1}child config${global_arg_delim_2}meta${global_arg_delim_3}subscript account${global_arg_delim_2}ethereum-based${global_arg_delim_3}metamask
|
||||
|
||||
\e[32mNotes:\e[0m
|
||||
|
||||
@@ -307,7 +307,7 @@ function lib_gen::__parse_args()
|
||||
fi
|
||||
read -ra _read <<<"$_arg_config"
|
||||
for _arg in "${_read[@]}"; do
|
||||
if [[ ! "$_arg" =~ ^fetch$|^hledger$|^meta$|^subprofile$ ]]; then
|
||||
if [[ ! "$_arg" =~ ^fetch$|^hledger$|^meta$|^subscript$ ]]; then
|
||||
lib_utils::die_usage "$_usage"
|
||||
fi
|
||||
done
|
||||
@@ -734,14 +734,14 @@ function lib_gen::__gen_subprofile_flow()
|
||||
{
|
||||
[[ -z "$_gen_path" || -z "$_gen_conf_path" ]] && lib_utils::die_fatal
|
||||
|
||||
if lib_gen::__gen_subprofile_flow_args_config "subprofile"; then
|
||||
if lib_gen::__gen_subprofile_flow_args_config "subscript"; then
|
||||
lib_utils::print_custom " \e[32m│ │ │\e[0m\n"
|
||||
lib_utils::print_custom " \e[32m│ │ ├─\e[34;1m Generate (or update) subprofile's shell script? [Y/n] \e[0m"
|
||||
lib_utils::print_custom " \e[32m│ │ ├─\e[34;1m Generate (or update) subprofile's subscript file? [Y/n] \e[0m"
|
||||
[ -z "$global_arg_confirm" ] && lib_utils::print_custom "\n" || read -p "" _read
|
||||
_confirm="${_read:-y}"
|
||||
if [[ "$_confirm" == [yY] || -z "$global_arg_confirm" ]]; then
|
||||
# Subprofile's shell script
|
||||
lib_gen::__gen_subprofile_flow_shell
|
||||
lib_gen::__gen_subprofile_flow_subscript
|
||||
# Append subprofile source to superscript
|
||||
lib_gen::__gen_subprofile_flow_superscript
|
||||
fi
|
||||
@@ -815,31 +815,31 @@ function lib_gen::__gen_subprofile_flow_args_account()
|
||||
}
|
||||
|
||||
#
|
||||
# Subprofile: flow: generate subprofile script
|
||||
# Subprofile: flow: generate subprofile subscript
|
||||
#
|
||||
|
||||
function lib_gen::__gen_subprofile_flow_shell()
|
||||
function lib_gen::__gen_subprofile_flow_subscript()
|
||||
{
|
||||
[[ -z "$_gen_path" || -z "$_gen_conf_path" ]] && lib_utils::die_fatal
|
||||
|
||||
local _dir="${_gen_conf_path}/shell"
|
||||
[ ! -d "$_dir" ] && mkdir -p "$_dir"
|
||||
|
||||
local _file="${_dir}/subprofile.bash"
|
||||
local _file="${_dir}/subscript.bash"
|
||||
if [ -f "$_file" ]; then
|
||||
lib_utils::print_custom " \e[32m│ │ │ └─\e[34m Subprofile script found, backup then generate new one? [Y/n] \e[0m"
|
||||
lib_utils::print_custom " \e[32m│ │ │ └─\e[34m Subprofile subscript found, backup then generate new one? [Y/n] \e[0m"
|
||||
[ -z "$global_arg_confirm" ] && lib_utils::print_custom "\n" || read -p "" _read
|
||||
_confirm="${_read:-y}"
|
||||
|
||||
if [[ "$_confirm" == [yY] || -z "$global_arg_confirm" ]]; then
|
||||
cp -a "$_file" "${_file}_${global_suffix}" || lib_utils::die_fatal
|
||||
|
||||
lib_gen::__gen_subprofile_flow_shell_write
|
||||
local _print_custom=" \e[32m│ │ │ └─\e[34m Edit (new) subprofile script now? [Y/n] \e[0m"
|
||||
lib_gen::__gen_subprofile_flow_subscript_write
|
||||
local _print_custom=" \e[32m│ │ │ └─\e[34m Edit (new) subprofile subscript now? [Y/n] \e[0m"
|
||||
fi
|
||||
else
|
||||
lib_gen::__gen_subprofile_flow_shell_write
|
||||
local _print_custom=" \e[32m│ │ │ └─\e[34m Edit (new) subprofile script now? [Y/n] \e[0m"
|
||||
lib_gen::__gen_subprofile_flow_subscript_write
|
||||
local _print_custom=" \e[32m│ │ │ └─\e[34m Edit (new) subprofile subscript now? [Y/n] \e[0m"
|
||||
fi
|
||||
|
||||
lib_utils::print_custom "$_print_custom"
|
||||
@@ -848,7 +848,7 @@ function lib_gen::__gen_subprofile_flow_shell()
|
||||
[[ "$_confirm" == [yY] || -z "$global_arg_confirm" ]] && $EDITOR "$_file"
|
||||
}
|
||||
|
||||
function lib_gen::__gen_subprofile_flow_shell_write()
|
||||
function lib_gen::__gen_subprofile_flow_subscript_write()
|
||||
{
|
||||
[[ -z "$DOCKER_FINANCE_CONTAINER_REPO" || -z "$DOCKER_FINANCE_CONTAINER_CMD" ]] && lib_utils::die_fatal
|
||||
|
||||
@@ -863,7 +863,7 @@ function lib_gen::__gen_subprofile_flow_shell_write()
|
||||
-e "s:@DOCKER_FINANCE_VERSION@:${global_client_version}:g" \
|
||||
-e "s:@DOCKER_FINANCE_PROFILE@:${_profile}:g" \
|
||||
-e "s:@DOCKER_FINANCE_SUBPROFILE@:${_subprofile}:g" \
|
||||
"${global_repo_conf_dir}/container/shell/subprofile.bash.in" >"$_file"
|
||||
"${global_repo_conf_dir}/container/shell/subscript.bash.in" >"$_file"
|
||||
}
|
||||
|
||||
#
|
||||
@@ -878,7 +878,7 @@ function lib_gen::__gen_subprofile_flow_superscript()
|
||||
[ ! -f "$global_shell_file" ] && lib_utils::die_fatal "Superscript does not exist!"
|
||||
|
||||
# Append subprofile source to superscript
|
||||
local -r _source="source \"\${DOCKER_FINANCE_CONTAINER_FLOW}/profiles/${_profile}/${_subprofile}/docker-finance.d/shell/subprofile.bash\""
|
||||
local -r _source="source \"\${DOCKER_FINANCE_CONTAINER_FLOW}/profiles/${_profile}/${_subprofile}/docker-finance.d/shell/subscript.bash\""
|
||||
lib_utils::print_custom " \e[32m│ │ │ └─\e[34m Appending subprofile to superscript\e[0m\n"
|
||||
|
||||
# If source subprofile does not exist, append
|
||||
|
||||
Reference in New Issue
Block a user