Skip to content

Commit 695f934

Browse files
authored
Add a -y /--yes command-line flag to assume yes on prompts (#2262)
* Add a `-y/--yes` flag to assume "Yes" for all prompts * Update menu_config_vars.sh * Update menu_add_app.sh * Update menu_add_var.sh * Update menu_value_prompt.sh * Update dialog_functions.sh * Update menu_value_prompt.sh * Squashed commit of the following: commit 6f36940 Author: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Date: Sat Oct 4 01:02:18 2025 +0000 Update actions/stale action to v10.1.0 * Update dialog_functions.sh * Update dialog_functions.sh * Squashed commit of the following: commit 2376033 Author: CLHatch <[email protected]> Date: Sat Oct 4 06:58:45 2025 -0500 Add the missing `--theme-list` and `--theme-table` command-line options (#2260) commit 6f36940 Author: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Date: Sat Oct 4 01:02:18 2025 +0000 Update actions/stale action to v10.1.0 * Squashed commit of the following: commit 71ca4c4 Author: CLHatch <[email protected]> Date: Sat Oct 4 12:36:05 2025 -0500 Disable the `ds -M apps` option. It is currently broken. (#2261) commit 2376033 Author: CLHatch <[email protected]> Date: Sat Oct 4 06:58:45 2025 -0500 Add the missing `--theme-list` and `--theme-table` command-line options (#2260) commit 6f36940 Author: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Date: Sat Oct 4 01:02:18 2025 +0000 Update actions/stale action to v10.1.0
1 parent 71ca4c4 commit 695f934

37 files changed

+153
-108
lines changed

.includes/cmdline.sh

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ parse_arguments() {
3333
local -a CurrentFlags=()
3434
local -a CurrentCommand=()
3535

36-
while getopts ":-:acefghilMprRsStTuvVx" OPTION; do
36+
while getopts ":-:acefghilMprRsStTuvVxy" OPTION; do
3737
if [[ ${OPTION} == "-" ]]; then
3838
# Rename the long option to --option
3939
OPTION="--${OPTARG}"
@@ -46,7 +46,8 @@ parse_arguments() {
4646
-f | --force) ;&
4747
-g | --gui) ;&
4848
-v | --verbose) ;&
49-
-x | --debug)
49+
-x | --debug) ;&
50+
-y | --yes)
5051
CurrentFlags+=("${OPTION}")
5152
continue
5253
;;
@@ -926,15 +927,18 @@ set_flags() {
926927
fi
927928
;;
928929
-v | --verbose)
929-
declare -gx VERBOSE=1
930+
declare -gx VERBOSE=true
930931
;;
931932
-x | --debug)
932-
declare -gx DEBUG=1
933+
declare -gx DEBUG=true
934+
;;
935+
-y | --yes)
936+
declare -gx ASSUMEYES=true
933937
;;
934938
esac
935939
done
936940
if [[ -n ${DEBUG-} && -n ${VERBOSE-} ]]; then
937-
declare -gx TRACE=1
941+
declare -gx TRACE=true
938942
fi
939943
if [[ -n ${DEBUG-} ]]; then
940944
set -x
@@ -944,7 +948,7 @@ set_flags() {
944948
unset_flags() {
945949
set +x
946950
declare -gx PROMPT="CLI"
947-
unset FORCE VERBOSE DEBUG TRACE
951+
unset ASSUMEYES FORCE VERBOSE DEBUG TRACE
948952
}
949953

950954
cmdline_error() {

.includes/dialog_functions.sh

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,13 @@ _dialog_backtitle_() {
3636

3737
local LeftHeading="${DC["Hostname"]-}${HOSTNAME}${DC["NC"]-}"
3838
local -A FlagOption=(
39-
["ASSUMEYES"]="YES"
39+
["DEBUG"]="DEBUG"
4040
["FORCE"]="FORCE"
4141
["VERBOSE"]="VERBOSE"
42-
["DEBUG"]="DEBUG"
42+
["ASSUMEYES"]="YES"
4343
)
4444
local FlagsEnabled
45-
for Flag in ASSUMEYES FORCE VERBOSE DEBUG; do
45+
for Flag in DEBUG FORCE VERBOSE ASSUMEYES; do
4646
if [[ -n ${!Flag-} ]]; then
4747
if [[ -n ${FlagsEnabled-} ]]; then
4848
FlagsEnabled+="${DC["ApplicationFlagsSpace"]-}|${DC["NC"]-}"
@@ -76,6 +76,7 @@ _dialog_backtitle_() {
7676
fi
7777

7878
local -i HeadingLength
79+
COLUMNS=$(tput cols)
7980
HeadingLength=$((COLUMNS - 2))
8081

8182
local CleanLeftHeading CleanCenterHeading CleanRightHeading

.includes/usage.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,13 @@ EOF
7373
cat << EOF
7474
${C["UsageCommand"]-}-x --debug${NC-}
7575
Debug
76+
EOF
77+
;;&
78+
-y | --yes | "")
79+
Found=1
80+
cat << EOF
81+
${C["UsageCommand"]-}-y --yes${NC-}
82+
Assume Yes for all prompts
7683
EOF
7784
;;&
7885
"")

.scripts/appvars_purge.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ appvars_purge() {
7575
Question+="${Indent}${Indent}${C["Var"]}${line}${NC}\n"
7676
done
7777
fi
78-
if [[ ${CI-} == true ]] || run_script 'question_prompt' Y "${Question}" "${Title}" "${FORCE:+Y}"; then
78+
if [[ ${CI-} == true ]] || run_script 'question_prompt' Y "${Question}" "${Title}" "${ASSUMEYES:+Y}"; then
7979
info "Purging '${C["App"]}${AppName}${NC}' variables."
8080

8181
if [[ -n ${GlobalVarsToRemove[*]-} ]]; then

.scripts/appvars_purge_all.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ appvars_purge_all() {
77
local DISABLED_APPS
88
DISABLED_APPS="$(run_script 'app_list_disabled')"
99
if [[ -n ${DISABLED_APPS-} ]]; then
10-
if [[ ${CI-} == true ]] || run_script 'question_prompt' Y "Would you like to purge variables for all disabled apps?" "${Title}" "${FORCE:+Y}"; then
10+
if [[ ${CI-} == true ]] || run_script 'question_prompt' Y "Would you like to purge variables for all disabled apps?" "${Title}" "${ASSUMEYES:+Y}"; then
1111
info "Purging disabled app variables."
1212
for APPNAME in ${DISABLED_APPS-}; do
1313
run_script 'appvars_purge' "${APPNAME}"

.scripts/docker_compose.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ docker_compose() {
106106
esac
107107

108108
local -i result=0
109-
if run_script 'question_prompt' Y "${Question}" "${Title}" "${FORCE:+Y}"; then
109+
if run_script 'question_prompt' Y "${Question}" "${Title}" "${ASSUMEYES:+Y}"; then
110110
if use_dialog_box; then
111111
Title="$(strip_ansi_colors "${Title}")"
112112
Question="$(strip_ansi_colors "${Question}")"

.scripts/docker_prune.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ docker_prune() {
99
NoNotice="Nothing will be removed."
1010

1111
local Command="docker system prune --all --force --volumes"
12-
if run_script 'question_prompt' Y "${Question}" "${Title}" "${FORCE:+Y}"; then
12+
if run_script 'question_prompt' Y "${Question}" "${Title}" "${ASSUMEYES:+Y}"; then
1313
if use_dialog_box; then
1414
{
1515
notice "${YesNotice}"

.scripts/get_docker.sh

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,18 @@ IFS=$'\n\t'
44

55
get_docker() {
66
Title="Install Docker"
7-
notice "Installing docker. Please be patient, this can take a while."
8-
if run_script 'question_prompt' Y "Would you like to display the command output?" "${Title}" "${VERBOSE:+Y}"; then
7+
if [[ -n ${VERBOSE-} ]]; then
98
if use_dialog_box; then
10-
command_get_docker |& dialog_pipe "${Title}" "Installing docker. Please be patient, this can take a while."
9+
{
10+
notice "Installing docker. Please be patient, this can take a while."
11+
command_get_docker
12+
} |& dialog_pipe "${Title}" "Installing docker. Please be patient, this can take a while."
1113
else
14+
notice "Installing docker. Please be patient, this can take a while."
1215
command_get_docker
1316
fi
1417
else
18+
notice "Installing docker. Please be patient, this can take a while."
1519
command_get_docker > /dev/null 2>&1
1620
fi
1721
}

.scripts/menu_add_app.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ menu_add_app() {
7070
local Question
7171
Question="Create user defined application ${DC["Highlight"]-}${AppName}${DC["NC"]-}?\n"
7272
Heading="$(run_script 'menu_heading' "${AppNameHeading}")"
73-
if run_script 'question_prompt' N "${Heading}\n\n${Question}" "Create Application" "" "User Defined" "Back"; then
73+
if run_script 'question_prompt' N "${Heading}\n\n${Question}" "Create Application" "${ASSUMEYES:+Y}" "User Defined" "Back"; then
7474
Heading="$(run_script 'menu_heading' "${AppNameHeading}")"
7575
dialog_success "Adding User Defined Application" "${Heading}" "${DIALOGTIMEOUT}"
7676
run_script 'menu_add_var' "${AppName}"

.scripts/menu_add_var.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ menu_add_var() {
201201
Question+="\n ${DC["Highlight"]-}${Option// /}${DC["NC"]-}"
202202
done
203203
Heading="$(run_script 'menu_heading' ":${AppName}")"
204-
if run_script 'question_prompt' N "${Heading}\n\n${Question}" "Create Stock Variables" "" "Create" "Back"; then
204+
if run_script 'question_prompt' N "${Heading}\n\n${Question}" "Create Stock Variables" "${ASSUMEYES:+Y}" "Create" "Back"; then
205205
Heading="$(run_script 'menu_heading' ":${AppName}" "${VarNameHeading}")"
206206
coproc {
207207
dialog_pipe "${DC["TitleSuccess"]-}Creating Stock Variables" "${Heading}"
@@ -242,7 +242,7 @@ menu_add_var() {
242242
local DetectedAppName
243243
if [[ -z ${VarName-} ]]; then
244244
Heading="$(run_script 'menu_heading' ":${AppName}" "${VarNameHeading}")"
245-
if run_script 'question_prompt' N "${Heading}\n\nDo you really want to cancel adding a variable?\n" "Cancel Adding Variable" "" "Done" "Back"; then
245+
if run_script 'question_prompt' N "${Heading}\n\nDo you really want to cancel adding a variable?\n" "Cancel Adding Variable" "${ASSUMEYES:+Y}" "Done" "Back"; then
246246
# Value is empty, exit
247247
return
248248
fi
@@ -266,7 +266,7 @@ menu_add_var() {
266266
fi
267267
Question="Create variable ${DC["Highlight"]-}${VarName}${DC["NC"]-} for application ${DC["Highlight"]-}${AppName}${DC["NC"]-}?\n"
268268
Heading="$(run_script 'menu_heading' "$:{AppName}" "${VarNameHeading}")"
269-
if run_script 'question_prompt' N "${Heading}\n\n${Question}" "Create Variable" "" "Create" "Back"; then
269+
if run_script 'question_prompt' N "${Heading}\n\n${Question}" "Create Variable" "${ASSUMEYES:+Y}" "Create" "Back"; then
270270
Default="$(run_script 'var_default_value' "${VarName}")"
271271
Heading="$(run_script 'menu_heading' ":${AppName}" "${VarNameHeading}")"
272272
run_script_dialog "${DC["TitleSuccess"]-}Creating Variable" "${Heading}\n\n" "${DIALOGTIMEOUT}" \
@@ -339,7 +339,7 @@ menu_add_var() {
339339
Question="Create variable ${DC["Highlight"]-}${VarName}${DC["NC"]-}?\n"
340340
if [[ ${VarType} == "APPENV" ]]; then
341341
Question="Create variable ${DC["Highlight"]-}${VarName}${DC["NC"]-} for application ${DC["Highlight"]-}${AppName}${DC["NC"]-}?\n"
342-
if run_script 'question_prompt' N "${Heading}\n\n${Question}" "Create Variable" "" "Create" "Back"; then
342+
if run_script 'question_prompt' N "${Heading}\n\n${Question}" "Create Variable" "${ASSUMEYES:+Y}" "Create" "Back"; then
343343
Default="$(run_script 'var_default_value' "${AppName}:${VarName}")"
344344
Heading="$(run_script 'menu_heading' "${AppNameHeading}" "${VarNameHeading}")"
345345
run_script_dialog "${DC["TitleSuccess"]-}Creating Variable" "${Heading}\n\n" "${DIALOGTIMEOUT}" \
@@ -350,7 +350,7 @@ menu_add_var() {
350350
else # GLOBAL
351351
Heading="$(run_script 'menu_heading' "${AppNameHeading}" "${VarNameHeading}")"
352352
Question="Create global variable ${DC["Highlight"]-}${VarName}${DC["NC"]-}?\n"
353-
if run_script 'question_prompt' N "${Heading}\n\n${Question}" "Create Variable" "" "Create" "Back"; then
353+
if run_script 'question_prompt' N "${Heading}\n\n${Question}" "Create Variable" "${ASSUMEYES:+Y}" "Create" "Back"; then
354354
Default="$(run_script 'var_default_value' "${VarName}")"
355355
Heading="$(run_script 'menu_heading' "${AppNameHeading}" "${VarNameHeading}")"
356356
run_script_dialog "${DC["TitleSuccess"]-}Creating Variable" "${Heading}\n\n" "${DIALOGTIMEOUT}" \

0 commit comments

Comments
 (0)