helpers: Add useful log in case of empty config

pull/1865/head
Noah Gorny 2021-04-18 23:00:37 +03:00
parent df560ca04a
commit d4ec41bef7
1 changed files with 14 additions and 2 deletions

View File

@ -499,18 +499,30 @@ _bash-it-profile-save() {
done done
fi fi
local something_exists
echo "# This file is auto generated by Bash-it. Do not edit manually!" > "$profile_path" echo "# This file is auto generated by Bash-it. Do not edit manually!" > "$profile_path"
for subdirectory in "plugins" "completion" "aliases"; do for subdirectory in "plugins" "completion" "aliases"; do
local component_exists=""
echo "Saving $subdirectory configuration..." echo "Saving $subdirectory configuration..."
echo "" >> "$profile_path"
echo "# $subdirectory" >> "$profile_path"
for f in "${BASH_IT}/$subdirectory/available/"*.bash; do for f in "${BASH_IT}/$subdirectory/available/"*.bash; do
_bash-it-determine-component-status-from-path "$f" _bash-it-determine-component-status-from-path "$f"
if [ "$enabled" == "x" ]; then 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" echo "$subdirectory $enabled_file_clean" >> "$profile_path"
fi fi
done done
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 "All done!"
echo "" echo ""
echo "Profile location: $profile_path" echo "Profile location: $profile_path"