@@ -53,6 +53,9 @@ parse_arguments() {
5353 ;;
5454
5555 # --command
56+ --config-pm-auto) ;&
57+ --config-pm-list | --config-pm-table) ;&
58+ --config-pm-existing-list | --config-pm-existing-table) ;&
5659 -e | --env) ;&
5760 -i | --install) ;&
5861 -l | --list) ;&
@@ -99,6 +102,19 @@ parse_arguments() {
99102 break
100103 ;;
101104
105+ --config-pm)
106+ if [[ -z ${! OPTIND-} || ${! OPTIND} == " -" * ]]; then
107+ cmdline_error \
108+ " ${OPTION} " \
109+ " Command %c requires a package manager name." \
110+ " ${ParsedArgs[@]} " " ${CurrentFlags[@]} " " ${CurrentCommand[@]} " " ${OPTION} "
111+ exit 1
112+ fi
113+ CurrentCommand+=(" ${OPTION} " " ${! OPTIND} " )
114+ OPTIND+=1
115+ break
116+ ;;
117+
102118 -M | --menu)
103119 CurrentCommand=(" ${OPTION} " )
104120 if [[ -n ${! OPTIND-} && ${! OPTIND} != " -" * ]]; then
@@ -364,6 +380,12 @@ run_command() {
364380 [" --add" ]=" appvars_create"
365381 [" -c" ]=" docker_compose"
366382 [" --compose" ]=" docker_compose"
383+ [" --config-pm" ]=" config_package_manager"
384+ [" --config-pm-auto" ]=" config_package_manager"
385+ [" --config-pm-list" ]=" package_manager_list"
386+ [" --config-pm-table" ]=" package_manager_table"
387+ [" --config-pm-existing-list" ]=" package_manager_existing_list"
388+ [" --config-pm-existing-table" ]=" package_manager_existing_table"
367389 [" -e" ]=" appvars_create_all"
368390 [" --env" ]=" appvars_create_all"
369391 [" --env-appvars" ]=" appvars_list"
@@ -441,6 +463,12 @@ run_command() {
441463 [" -a" ]=1
442464 [" --add" ]=1
443465 [" -e" ]=1
466+ [" --config-pm" ]=1
467+ [" --config-pm-auto" ]=1
468+ [" --config-pm-list" ]=1
469+ [" --config-pm-table" ]=1
470+ [" --config-pm-existing-list" ]=1
471+ [" --config-pm-existing-table" ]=1
444472 [" --env" ]=1
445473 [" --list" ]=1
446474 [" -r" ]=1
@@ -452,6 +480,12 @@ run_command() {
452480 CommandTitle+=(
453481 [" -a" ]=" Add Application"
454482 [" --add" ]=" Add Application"
483+ [" --config-pm" ]=" Select package manager"
484+ [" --config-pm-auto" ]=" Select package manager"
485+ [" --config-pm-list" ]=" List known package managers"
486+ [" --config-pm-table" ]=" List known package managers"
487+ [" --config-pm-existing-list" ]=" List existing package managers"
488+ [" --config-pm-existing-table" ]=" List existing package managers"
455489 [" -e" ]=" ${DC["TitleSuccess"]-} Creating environment variables for added apps"
456490 [" --env" ]=" ${DC["TitleSuccess"]-} Creating environment variables for added apps"
457491 [" --env-appvars" ]=" Variables for Application"
@@ -674,6 +708,9 @@ run_command() {
674708 ;;
675709 -a | --add) ;&
676710 -c | --compose) ;&
711+ --config-pm) ;&
712+ --config-pm-list | --config-pm-table) ;&
713+ --config-pm-existing-list | --config-pm-existing-table) ;&
677714 -e | --env) ;&
678715 -i | --install) ;&
679716 --list) ;&
@@ -725,6 +762,44 @@ run_command() {
725762 fi
726763 ;;
727764
765+ --config-pm-auto)
766+ if [[ -z ${Script} ]]; then
767+ fatal \
768+ " No script is defined for command '${C["UserCommand"]-}${Command}${NC-} '.\n" \
769+ " Please let the dev know."
770+ fi
771+ if [[ -n ${EnvCreate-} ]]; then
772+ run_script ' env_create'
773+ fi
774+ if [[ -n ${EnvBackup-} ]]; then
775+ run_script ' env_backup'
776+ fi
777+ if [[ ${RequireDialog-} ]]; then
778+ if [[ -z ${DIALOG-} ]]; then
779+ fatal \
780+ " The GUI requires the '${C["Program"]-} dialog${NC-} ' command to be installed.\n" \
781+ " '${C["Program"]-} dialog${NC-} ' command not found. Run '${C["UserCommand"]-}${APPLICATION_COMMAND} -i${NC-} ' to install all dependencies.\n" \
782+ " \n" \
783+ " Unable to start GUI without the '${C["Program"]-} dialog${NC-} ' command.\n"
784+ fi
785+ declare -gx PROMPT=" GUI"
786+ run_script " ${Script} " " "
787+ result=$?
788+ else
789+ if [[ ${UseDialog} ]]; then
790+ run_script_dialog " ${Title} " " ${SubTitle} " " " \
791+ " ${Script} " " "
792+ result=$?
793+ else
794+ run_script " ${Script} " " "
795+ result=$?
796+ fi
797+ fi
798+ if [[ -n ${EnvUpdate-} ]]; then
799+ run_script ' env_update'
800+ fi
801+ ;;
802+
728803 --menu-config-app)
729804 if [[ -z ${Script} ]]; then
730805 fatal \
@@ -766,10 +841,10 @@ run_command() {
766841 fi
767842 notice " ${NoticeText} "
768843 if use_dialog_box; then
769- run_script ' apply_theme ' " ${ThemeName} " && run_script ' menu_dialog_example' " " " ${CURRENT_COMMANDLINE} "
844+ run_script ' config_theme ' " ${ThemeName} " && run_script ' menu_dialog_example' " " " ${CURRENT_COMMANDLINE} "
770845 result=$?
771846 else
772- run_script ' apply_theme ' " ${ThemeName} "
847+ run_script ' config_theme ' " ${ThemeName} "
773848 result=$?
774849 fi
775850 ;;
0 commit comments