Change the enable/disable functions to use the global directory
This commit is contained in:
@@ -273,6 +273,7 @@ _disable-thing ()
|
||||
|
||||
if [ "$file_entity" = "all" ]; then
|
||||
typeset f $file_type
|
||||
# Disable everything that's using the old structure
|
||||
for f in "${BASH_IT}/$subdirectory/available/"*.bash
|
||||
do
|
||||
plugin=$(basename $f)
|
||||
@@ -283,6 +284,18 @@ _disable-thing ()
|
||||
rm "${BASH_IT}/$subdirectory/enabled/"*$BASH_IT_LOAD_PRIORITY_SEPARATOR$(basename $plugin)
|
||||
fi
|
||||
done
|
||||
|
||||
local suffix=$(echo "$subdirectory" | sed -e 's/plugins/plugin/g')
|
||||
|
||||
# Disable everything in the global "enabled" directory
|
||||
for f in "${BASH_IT}/$subdirectory/available/"*.${suffix}.bash
|
||||
do
|
||||
plugin=$(basename $f)
|
||||
|
||||
if [ -e "${BASH_IT}/enabled/"*$BASH_IT_LOAD_PRIORITY_SEPARATOR$plugin ]; then
|
||||
rm "${BASH_IT}/enabled/"*$BASH_IT_LOAD_PRIORITY_SEPARATOR$(basename $plugin)
|
||||
fi
|
||||
done
|
||||
else
|
||||
typeset plugin_global=$(command ls $ "${BASH_IT}/enabled/"[0-9]*$BASH_IT_LOAD_PRIORITY_SEPARATOR$file_entity.*bash 2>/dev/null | head -1)
|
||||
if [ -z "$plugin_global" ]; then
|
||||
@@ -380,6 +393,12 @@ _enable-thing ()
|
||||
return
|
||||
fi
|
||||
|
||||
typeset enabled_plugin=$(command ls "${BASH_IT}/enabled/"[0-9]*$BASH_IT_LOAD_PRIORITY_SEPARATOR$to_enable 2>/dev/null | head -1)
|
||||
if [ ! -z "$enabled_plugin" ] ; then
|
||||
printf '%s\n' "$file_entity is already enabled."
|
||||
return
|
||||
fi
|
||||
|
||||
mkdir -p "${BASH_IT}/enabled"
|
||||
|
||||
# Load the priority from the file if it present there
|
||||
|
||||
Reference in New Issue
Block a user