Merge pull request #1177 from dracorp/additional-command-reload
Additional command reloadpull/1193/head
commit
af5c215942
22
bash_it.sh
22
bash_it.sh
|
|
@ -1,16 +1,6 @@
|
|||
#!/usr/bin/env bash
|
||||
# Initialize Bash It
|
||||
|
||||
# Reload Library
|
||||
case $OSTYPE in
|
||||
darwin*)
|
||||
alias reload='source ~/.bash_profile'
|
||||
;;
|
||||
*)
|
||||
alias reload='source ~/.bashrc'
|
||||
;;
|
||||
esac
|
||||
|
||||
# Only set $BASH_IT if it's not already set
|
||||
if [ -z "$BASH_IT" ];
|
||||
then
|
||||
|
|
@ -112,5 +102,17 @@ then
|
|||
. "$HOME/.jekyllconfig"
|
||||
fi
|
||||
|
||||
# BASH_IT_RELOAD_LEGACY is set.
|
||||
if ! command -v reload &>/dev/null && [ -n "$BASH_IT_RELOAD_LEGACY" ]; then
|
||||
case $OSTYPE in
|
||||
darwin*)
|
||||
alias reload='source ~/.bash_profile'
|
||||
;;
|
||||
*)
|
||||
alias reload='source ~/.bashrc'
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# Disable trap DEBUG on subshells - https://github.com/Bash-it/bash-it/pull/1040
|
||||
set +T
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ _bash-it-comp()
|
|||
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
||||
chose_opt="${COMP_WORDS[1]}"
|
||||
file_type="${COMP_WORDS[2]}"
|
||||
opts="disable enable help migrate search show update version"
|
||||
opts="disable enable help migrate reload search show update version"
|
||||
case "${chose_opt}" in
|
||||
show)
|
||||
local show_args="aliases completions plugins"
|
||||
|
|
@ -82,7 +82,7 @@ _bash-it-comp()
|
|||
return 0
|
||||
fi
|
||||
;;
|
||||
update | search | migrate | version)
|
||||
migrate | reload | search | update | version)
|
||||
return 0
|
||||
;;
|
||||
enable | disable)
|
||||
|
|
|
|||
|
|
@ -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,6 +96,8 @@ bash-it ()
|
|||
func=_bash-it-migrate;;
|
||||
version)
|
||||
func=_bash-it-version;;
|
||||
reload)
|
||||
func=_bash-it-reload;;
|
||||
*)
|
||||
reference bash-it
|
||||
return;;
|
||||
|
|
@ -253,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'
|
||||
|
|
|
|||
|
|
@ -48,5 +48,8 @@ export SCM_CHECK=true
|
|||
# after enabling or disabling aliases, plugins, and completions.
|
||||
# export BASH_IT_AUTOMATIC_RELOAD_AFTER_CONFIG_CHANGE=1
|
||||
|
||||
# Uncomment this to make Bash-it create alias reload.
|
||||
# export BASH_IT_RELOAD_LEGACY=1
|
||||
|
||||
# Load Bash It
|
||||
source "$BASH_IT"/bash_it.sh
|
||||
|
|
|
|||
|
|
@ -99,32 +99,32 @@ function __check_completion () {
|
|||
|
||||
@test "completion bash-it: show options" {
|
||||
run __check_completion 'bash-it '
|
||||
assert_line -n 0 "disable enable help migrate search show update version"
|
||||
assert_line -n 0 "disable enable help migrate reload search show update version"
|
||||
}
|
||||
|
||||
@test "completion bash-it: bash-ti - show options" {
|
||||
run __check_completion 'bash-ti '
|
||||
assert_line -n 0 "disable enable help migrate search show update version"
|
||||
assert_line -n 0 "disable enable help migrate reload search show update version"
|
||||
}
|
||||
|
||||
@test "completion bash-it: shit - show options" {
|
||||
run __check_completion 'shit '
|
||||
assert_line -n 0 "disable enable help migrate search show update version"
|
||||
assert_line -n 0 "disable enable help migrate reload search show update version"
|
||||
}
|
||||
|
||||
@test "completion bash-it: bashit - show options" {
|
||||
run __check_completion 'bashit '
|
||||
assert_line -n 0 "disable enable help migrate search show update version"
|
||||
assert_line -n 0 "disable enable help migrate reload search show update version"
|
||||
}
|
||||
|
||||
@test "completion bash-it: batshit - show options" {
|
||||
run __check_completion 'batshit '
|
||||
assert_line -n 0 "disable enable help migrate search show update version"
|
||||
assert_line -n 0 "disable enable help migrate reload search show update version"
|
||||
}
|
||||
|
||||
@test "completion bash-it: bash_it - show options" {
|
||||
run __check_completion 'bash_it '
|
||||
assert_line -n 0 "disable enable help migrate search show update version"
|
||||
assert_line -n 0 "disable enable help migrate reload search show update version"
|
||||
}
|
||||
|
||||
@test "completion bash-it: show - show options" {
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ unset NGINX_PATH
|
|||
unset IRC_CLIENT
|
||||
unset TODO
|
||||
unset SCM_CHECK
|
||||
unset BASH_IT_AUTOMATIC_RELOAD_AFTER_CONFIG_CHANGE
|
||||
|
||||
BASH_IT_TEST_DIR="${BATS_TMPDIR}/.bash_it"
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue