Speed up bash-it Search & support exact matches

This commit improves Bash-It search functionality in a couple of ways:

 * bash-it search (with no arguments) will print detailed help.
 * bash-it search now accepts terms prefixed with '@' sign, indicating an exact match.
 * bash-it search now performs smarter caching of the component listings/status

New search syntax is as follows:

   bash-it search [-|@]term1 [-|@]term2 [ --enable | --disable | --help ]
This commit is contained in:
Konstantin Gredeskoul
2018-11-17 17:45:44 -08:00
parent 8feebc0aa9
commit baae0305b6
4 changed files with 419 additions and 135 deletions

View File

@@ -70,7 +70,7 @@ bash-it ()
example '$ bash-it disable alias hg [tmux]...'
example '$ bash-it migrate'
example '$ bash-it update'
example '$ bash-it search ruby [[-]rake]... [--enable | --disable]'
example '$ bash-it search [-|@]term1 [-|@]term2 ... [--enable | --disable | --help | --refresh | --no-color ]'
example '$ bash-it version'
example '$ bash-it reload'
typeset verb=${1:-}
@@ -393,6 +393,9 @@ _disable-thing ()
fi
fi
local flag="DEFER_CACHE_CLEANUP_FOR_${file_type}"
[[ -z ${!flag} ]] && _bash_it_search_cache_clean "${file_type}"
if [ -n "$BASH_IT_AUTOMATIC_RELOAD_AFTER_CONFIG_CHANGE" ]; then
exec ${0/-/}
fi
@@ -488,6 +491,9 @@ _enable-thing ()
ln -s ../$subdirectory/available/$to_enable "${BASH_IT}/enabled/${use_load_priority}${BASH_IT_LOAD_PRIORITY_SEPARATOR}${to_enable}"
fi
local flag="DEFER_CACHE_CLEANUP_FOR_${file_type}"
[[ -z ${!flag} ]] && _bash_it_search_cache_clean "${file_type}"
if [ -n "$BASH_IT_AUTOMATIC_RELOAD_AFTER_CONFIG_CHANGE" ]; then
exec ${0/-/}
fi