Skip to content

Commit 0f0093d

Browse files
committed
lib/helpers: quotes for consistency
Quote some parameter uses that don't strictly require it, but since Bash needs so many quotes everywhere else my brain worms feel better when these are quoted too. lib/helpers: simplify some quote escapes
1 parent dfc3fa4 commit 0f0093d

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

lib/helpers.bash

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ function bash-it() {
119119
shift
120120
local func
121121

122-
case $verb in
122+
case "$verb" in
123123
show)
124124
func="_bash-it-$component"
125125
;;
@@ -487,7 +487,7 @@ function _bash-it-profile-save() {
487487
local name="${1:-}"
488488
while [[ -z "$name" ]]; do
489489
read -r -e -p "Please enter the name of the profile to save: " name
490-
case $name in
490+
case "$name" in
491491
"")
492492
echo -e "${echo_orange?}Please choose a name.${echo_reset_color?}"
493493
;;
@@ -499,12 +499,12 @@ function _bash-it-profile-save() {
499499

500500
local profile_path="${BASH_IT}/profiles/${name}.bash_it" RESP
501501
if [[ -s "$profile_path" ]]; then
502-
echo -e "${echo_yellow?}Profile \"$name\" already exists.${echo_reset_color?}"
502+
echo -e "${echo_yellow?}Profile '$name' already exists.${echo_reset_color?}"
503503
while true; do
504504
read -r -e -n 1 -p "Would you like to overwrite existing profile? [y/N] " RESP
505-
case $RESP in
505+
case "$RESP" in
506506
[yY])
507-
echo -e "${echo_green?}Overwriting profile \"$name\"...${echo_reset_color?}"
507+
echo -e "${echo_green?}Overwriting profile '$name'...${echo_reset_color?}"
508508
rm "$profile_path"
509509
break
510510
;;
@@ -519,14 +519,13 @@ function _bash-it-profile-save() {
519519
done
520520
fi
521521

522-
local something_exists subdirectory
522+
local something_exists subdirectory component_exists f enabled_file
523523
echo "# This file is auto generated by Bash-it. Do not edit manually!" > "$profile_path"
524524
for subdirectory in "plugins" "completion" "aliases"; do
525-
local component_exists="" f
526525
echo "Saving $subdirectory configuration..."
527-
for f in "${BASH_IT}/$subdirectory/available/"*.bash; do
526+
for f in "${BASH_IT}/$subdirectory/available"/*.bash; do
528527
if _bash-it-component-item-is-enabled "$f"; then
529-
if [[ -z "$component_exists" ]]; then
528+
if [[ -z "${component_exists:-}" ]]; then
530529
# This is the first component of this type, print the header
531530
component_exists="yes"
532531
something_exists="yes"
@@ -917,7 +916,7 @@ function _help-aliases() {
917916
_example '$ alias-help git'
918917

919918
if [[ -n "$1" ]]; then
920-
case $1 in
919+
case "$1" in
921920
custom)
922921
alias_path='custom.aliases.bash'
923922
;;

0 commit comments

Comments
 (0)