Added additional parameter for bash-it: reload
Added creating an alias if command does not exist
This commit is contained in:
16
lib/additionals.bash
Normal file
16
lib/additionals.bash
Normal file
@@ -0,0 +1,16 @@
|
||||
_bash-it-additional-reload() {
|
||||
_about 'reloads ~/.bashrc'
|
||||
|
||||
case $OSTYPE in
|
||||
darwin*)
|
||||
source ~/.bash_profile
|
||||
;;
|
||||
*)
|
||||
source ~/.bashrc
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
if ! command -v reload 1>/dev/null; then
|
||||
alias reload=_bash-it-additional-reload
|
||||
fi
|
||||
@@ -96,8 +96,7 @@ bash-it ()
|
||||
version)
|
||||
func=_bash-it-version;;
|
||||
*)
|
||||
reference bash-it
|
||||
return;;
|
||||
func=_bash-it-additional-$verb $component "$@"
|
||||
esac
|
||||
|
||||
# pluralize component if necessary
|
||||
@@ -107,6 +106,10 @@ 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
|
||||
|
||||
Reference in New Issue
Block a user