Added additional parameter for bash-it: reload

Added creating an alias if command does not exist
This commit is contained in:
Piotr Rogoża
2018-04-14 00:49:20 +02:00
parent cd983294ec
commit b1dbf2f7e0
4 changed files with 32 additions and 13 deletions

16
lib/additionals.bash Normal file
View 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

View File

@@ -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