@@ -550,7 +550,8 @@ argument_processing()
550550 exit 0
551551 ;;
552552
553- --readme|readme|features|FEATURES|FEATURES.sh|features.sh) # Print list of possible arguments and finish the program
553+ --readme|readme|features|FEATURES|FEATURES.sh|features.sh)
554+ # Print list of possible arguments and finish the program
554555 autogen_readme
555556 exit 0
556557 ;;
@@ -578,42 +579,55 @@ argument_processing()
578579 add_programs_with_x_permissions 2
579580 ;;
580581
581- * ) # Individual argument
582+ --flush=favorites)
582583 if [ " ${FLAG_MODE} " == " uninstall" ]; then
583- case " ${key} " in
584- --flush=favorites)
585- remove_all_favorites
586- shift
587- continue
588- ;;
589- --flush=keybindings)
590- remove_all_keybindings
591- shift
592- continue
593- ;;
594- --flush=functions)
595- remove_all_functions
596- shift
597- continue
598- ;;
599- --flush=initializations)
600- remove_all_initializations
601- shift
602- continue
603- ;;
604- --flush=structures)
605- remove_structures
606- shift
607- continue
608- ;;
609- --flush=cache)
610- rm -Rf " ${CACHE_FOLDER} "
611- shift
612- continue
613- ;;
614- esac
584+ remove_all_favorites
585+ fi
586+ ;;
587+
588+ --flush=keybindings)
589+ if [ " ${FLAG_MODE} " == " uninstall" ]; then
590+ remove_all_keybindings
591+ fi
592+ ;;
593+
594+ --flush=functions)
595+ if [ " ${FLAG_MODE} " == " uninstall" ]; then
596+ remove_all_functions
597+ fi
598+ ;;
599+
600+ --flush=initializations)
601+ if [ " ${FLAG_MODE} " == " uninstall" ]; then
602+ remove_all_initializations
603+ fi
604+ ;;
605+
606+ --flush=structures)
607+ if [ " ${FLAG_MODE} " == " uninstall" ]; then
608+ remove_structures
609+ fi
610+ ;;
611+
612+ --flush=cache)
613+ if [ " ${FLAG_MODE} " == " uninstall" ]; then
614+ rm -Rf " ${CACHE_FOLDER} "
615+ fi
616+ ;;
617+
618+ * )
619+ # Individual argument
620+ # A feature key name was not detected in the current argument ${key}. Try a wrapper.
621+ # But first check that the argument has characters and also check that those characters are valid characters
622+ # for a variable in bash (regexp [a-zA-Z_][a-zA-Z_0-9]*, which is equal to any string using alphanumeric
623+ # characters beginning with ant alphabetic characters and containing underscores at any position)
624+ if [ -z " ${key} " ] || ! echo " ${key} " | grep -Eo " ^[aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ_][aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ_0-9]*$" ; then
625+ output_proxy_executioner " The current argument \" ${key} \" is empty or not valid" " WARNING"
626+ shift
627+ continue
615628 fi
616629
630+ # Indirect expand wrapper variable
617631 local wrapper_key=
618632 wrapper_key=" $( echo " ${key} " | tr " -" " _" | tr -d " _" ) "
619633 local set_of_features=" wrapper_${wrapper_key} [*]"
@@ -629,7 +643,8 @@ argument_processing()
629643
630644 # If we don't receive arguments we try to install everything that we can given our permissions
631645 if [ ${# added_feature_keynames[@]} -eq 0 ]; then
632- output_proxy_executioner " No arguments provided to install feature. Use -h or --help to display information about usage. Aborting..." " WARNING"
646+ output_proxy_executioner " No arguments provided to install feature. Use -h or --help to display information about \
647+ usage. Aborting..." " ERROR"
633648 return
634649 fi
635650}
0 commit comments