Replaced reload section with proper function.
Added completion for reload. Fixed order in completion Added unit tests for completion The variable BASH_IT_AUTOMATIC_RELOAD_AFTER_CONFIG_CHANGE has to be unset.
This commit is contained in:
@@ -61,7 +61,7 @@ function reload_plugins() {
|
||||
bash-it ()
|
||||
{
|
||||
about 'Bash-it help and maintenance'
|
||||
param '1: verb [one of: help | show | enable | disable | migrate | update | search | version ] '
|
||||
param '1: verb [one of: help | show | enable | disable | migrate | update | search | version | reload ] '
|
||||
param '2: component type [one of: alias(es) | completion(s) | plugin(s) ] or search term(s)'
|
||||
param '3: specific component [optional]'
|
||||
example '$ bash-it show plugins'
|
||||
@@ -72,6 +72,7 @@ bash-it ()
|
||||
example '$ bash-it update'
|
||||
example '$ bash-it search ruby [[-]rake]... [--enable | --disable]'
|
||||
example '$ bash-it version'
|
||||
example '$ bash-it reload'
|
||||
typeset verb=${1:-}
|
||||
shift
|
||||
typeset component=${1:-}
|
||||
@@ -95,8 +96,11 @@ bash-it ()
|
||||
func=_bash-it-migrate;;
|
||||
version)
|
||||
func=_bash-it-version;;
|
||||
reload)
|
||||
func=_bash-it-reload;;
|
||||
*)
|
||||
func=_bash-it-additional-$verb $component "$@"
|
||||
reference bash-it
|
||||
return;;
|
||||
esac
|
||||
|
||||
# pluralize component if necessary
|
||||
@@ -106,10 +110,6 @@ bash-it ()
|
||||
else
|
||||
if _is_function ${func}es; then
|
||||
func=${func}es
|
||||
elif [[ $func =~ ^_bash-it-additional- ]]; then
|
||||
echo "oops! $verb is not valid additional command"
|
||||
reference bash-it
|
||||
return
|
||||
else
|
||||
echo "oops! $component is not a valid option!"
|
||||
reference bash-it
|
||||
@@ -256,6 +256,22 @@ _bash-it-version() {
|
||||
cd - &> /dev/null || return
|
||||
}
|
||||
|
||||
_bash-it-reload() {
|
||||
_about 'reloads a profile file'
|
||||
_group 'lib'
|
||||
|
||||
cd "${BASH_IT}" || return
|
||||
|
||||
case $OSTYPE in
|
||||
darwin*)
|
||||
source ~/.bash_profile
|
||||
;;
|
||||
*)
|
||||
source ~/.bashrc
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
_bash-it-describe ()
|
||||
{
|
||||
_about 'summarizes available bash_it components'
|
||||
|
||||
Reference in New Issue
Block a user