Skip to content

Commit

Permalink
lib/helpers: quotes for consistency
Browse files Browse the repository at this point in the history
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
  • Loading branch information
gaelicWizard committed Jan 18, 2022
1 parent dfc3fa4 commit 0f0093d
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions lib/helpers.bash
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ function bash-it() {
shift
local func

case $verb in
case "$verb" in
show)
func="_bash-it-$component"
;;
Expand Down Expand Up @@ -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?}"
;;
Expand All @@ -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
;;
Expand All @@ -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"
Expand Down Expand Up @@ -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'
;;
Expand Down

0 comments on commit 0f0093d

Please sign in to comment.