From 74b15b638515285884f569452c0a82968d88cb12 Mon Sep 17 00:00:00 2001 From: Nils Winkler Date: Wed, 10 May 2017 11:12:04 +0200 Subject: [PATCH] Reading load priority from file --- lib/helpers.bash | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/helpers.bash b/lib/helpers.bash index a1045c8f..0f41488f 100644 --- a/lib/helpers.bash +++ b/lib/helpers.bash @@ -333,14 +333,18 @@ _enable-thing () mkdir -p $BASH_IT/$subdirectory/enabled - ln -s ../available/$plugin $BASH_IT/$subdirectory/enabled/$load_priority$BASH_IT_LOAD_PRIORITY_SEPARATOR$plugin + # Load the priority from the file if it present there + local local_file_priority=$(grep -E "^# BASH_IT_LOAD_PRIORITY:" $BASH_IT/$subdirectory/available/$plugin | awk -F': ' '{ print $2 }') + local use_load_priority=${local_file_priority:-$load_priority} + + ln -s ../available/$plugin $BASH_IT/$subdirectory/enabled/$use_load_priority$BASH_IT_LOAD_PRIORITY_SEPARATOR$plugin fi if [ -n "$BASH_IT_AUTOMATIC_RELOAD_AFTER_CONFIG_CHANGE" ]; then exec ${0/-/} fi - printf '%s\n' "$file_entity enabled." + printf '%s\n' "$file_entity enabled with priority $use_load_priority." } _help-completions()