Skip to content

Commit

Permalink
helpers: Add useful log in case of empty config
Browse files Browse the repository at this point in the history
  • Loading branch information
Noah Gorny committed Sep 20, 2021
1 parent 0d924bc commit 9656b56
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions lib/helpers.bash
Original file line number Diff line number Diff line change
Expand Up @@ -499,18 +499,30 @@ _bash-it-profile-save() {
done
fi

local something_exists
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=""
echo "Saving $subdirectory configuration..."
echo "" >> "$profile_path"
echo "# $subdirectory" >> "$profile_path"
for f in "${BASH_IT}/$subdirectory/available/"*.bash; do
_bash-it-determine-component-status-from-path "$f"
if [ "$enabled" == "x" ]; then
if [ -z "$component_exists" ]; then
# This is the first component of this type, print the header
component_exists="yes"
something_exists="yes"
echo "" >> "$profile_path"
echo "# $subdirectory" >> "$profile_path"
fi
echo "$subdirectory $enabled_file_clean" >> "$profile_path"
fi
done
done
if [ -z "$something_exists" ]; then
echo "It seems like no configuration was enabled.."
echo "Make sure to double check that this is the wanted behavior."
fi

echo "All done!"
echo ""
echo "Profile location: $profile_path"
Expand Down

0 comments on commit 9656b56

Please sign in to comment.