diff --git a/lib/helpers.bash b/lib/helpers.bash index fbb3a00e..5bd88f54 100644 --- a/lib/helpers.bash +++ b/lib/helpers.bash @@ -119,7 +119,7 @@ function bash-it() { shift local func - case $verb in + case "$verb" in show) func="_bash-it-$component" ;; @@ -487,7 +487,7 @@ function _bash-it-profile-save() { local name="${1:-}" while [[ -z "$name" ]]; do read -r -e -p "Please enter the name of the profile to save: " name - case $name in + case "$name" in "") echo -e "${echo_orange?}Please choose a name.${echo_reset_color?}" ;; @@ -499,12 +499,12 @@ function _bash-it-profile-save() { local profile_path="${BASH_IT}/profiles/${name}.bash_it" RESP if [[ -s "$profile_path" ]]; then - echo -e "${echo_yellow?}Profile \"$name\" already exists.${echo_reset_color?}" + echo -e "${echo_yellow?}Profile '$name' already exists.${echo_reset_color?}" while true; do read -r -e -n 1 -p "Would you like to overwrite existing profile? [y/N] " RESP - case $RESP in + case "$RESP" in [yY]) - echo -e "${echo_green?}Overwriting profile \"$name\"...${echo_reset_color?}" + echo -e "${echo_green?}Overwriting profile '$name'...${echo_reset_color?}" rm "$profile_path" break ;; @@ -519,14 +519,13 @@ function _bash-it-profile-save() { done fi - local something_exists subdirectory + local something_exists subdirectory component_exists f enabled_file echo "# This file is auto generated by Bash-it. Do not edit manually!" > "$profile_path" for subdirectory in "plugins" "completion" "aliases"; do - local component_exists="" f echo "Saving $subdirectory configuration..." - for f in "${BASH_IT}/$subdirectory/available/"*.bash; do + for f in "${BASH_IT}/$subdirectory/available"/*.bash; do if _bash-it-component-item-is-enabled "$f"; then - if [[ -z "$component_exists" ]]; then + if [[ -z "${component_exists:-}" ]]; then # This is the first component of this type, print the header component_exists="yes" something_exists="yes" @@ -917,7 +916,7 @@ function _help-aliases() { _example '$ alias-help git' if [[ -n "$1" ]]; then - case $1 in + case "$1" in custom) alias_path='custom.aliases.bash' ;;