From aa9a63a10e25a0382a454416c62c04f79896674a Mon Sep 17 00:00:00 2001 From: Nils Winkler Date: Fri, 15 Sep 2017 08:10:17 +0200 Subject: [PATCH] Added message after migrating about possible fixes. See #985 for background. --- lib/helpers.bash | 10 ++++++++++ test/lib/helpers.bats | 6 ++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/lib/helpers.bash b/lib/helpers.bash index 3223b524..779e500b 100644 --- a/lib/helpers.bash +++ b/lib/helpers.bash @@ -187,6 +187,9 @@ _bash-it-migrate() { _about 'migrates Bash-it configuration from a previous format to the current one' _group 'lib' + declare migrated_something + migrated_something=false + for file_type in "aliases" "plugins" "completion" do for f in `sort <(compgen -G "${BASH_IT}/$file_type/enabled/*.bash")` @@ -198,6 +201,8 @@ _bash-it-migrate() { # Cut off the optional "250---" prefix and the suffix typeset component_name=$(echo $ff | sed -e 's/[0-9]*[-]*\(.*\)\..*\.bash/\1/g') + migrated_something=true + echo "Migrating $single_type $component_name." disable_func="_disable-$single_type" @@ -207,6 +212,11 @@ _bash-it-migrate() { $enable_func $component_name done done + + if [ "$migrated_something" = "true" ]; then + echo "" + echo "If any migration errors were reported, please try the following: reload && bash-it migrate" + fi } _bash-it-describe () diff --git a/test/lib/helpers.bats b/test/lib/helpers.bats index cd721871..4a92d09e 100644 --- a/test/lib/helpers.bats +++ b/test/lib/helpers.bats @@ -391,7 +391,8 @@ function __migrate_all_components() { assert_line "0" 'Migrating plugin nvm.' assert_line "1" 'nvm disabled.' assert_line "2" 'nvm enabled with priority 225.' - assert_line "3" 'node enabled with priority 250.' + assert_line "3" 'If any migration errors were reported, please try the following: reload && bash-it migrate' + assert_line "4" 'node enabled with priority 250.' assert [ ! -L "$BASH_IT/plugins/enabled/nvm.plugin.bash" ] assert [ -L "$BASH_IT/enabled/225---nvm.plugin.bash" ] assert [ -L "$BASH_IT/enabled/250---node.plugin.bash" ] @@ -410,7 +411,8 @@ function __migrate_all_components() { assert_line "3" 'Migrating plugin nvm.' assert_line "4" 'nvm disabled.' assert_line "5" 'nvm enabled with priority 225.' - assert_line "6" 'node disabled.' + assert_line "6" 'If any migration errors were reported, please try the following: reload && bash-it migrate' + assert_line "7" 'node disabled.' assert [ ! -L "$BASH_IT/plugins/enabled/nvm.plugin.bash" ] assert [ -L "$BASH_IT/enabled/225---nvm.plugin.bash" ] assert [ ! -L "$BASH_IT/plugins/enabled/250---node.plugin.bash" ]