New update command
parent
14f880202c
commit
3438c1d7c4
|
|
@ -32,13 +32,14 @@ function reload_plugins() {
|
|||
bash-it ()
|
||||
{
|
||||
about 'bash-it help and maintenance'
|
||||
param '1: verb [one of: help | show | enable | disable ]'
|
||||
param '1: verb [one of: help | show | enable | disable | update ] '
|
||||
param '2: component type [one of: alias(es) | completion(s) | plugin(s) ]'
|
||||
param '3: specific component [optional]'
|
||||
example '$ bash-it show plugins'
|
||||
example '$ bash-it help aliases'
|
||||
example '$ bash-it enable plugin git [tmux]...'
|
||||
example '$ bash-it disable alias hg [tmux]...'
|
||||
example '$ bash-it update'
|
||||
typeset verb=${1:-}
|
||||
shift
|
||||
typeset component=${1:-}
|
||||
|
|
@ -53,6 +54,8 @@ bash-it ()
|
|||
func=_disable-$component;;
|
||||
help)
|
||||
func=_help-$component;;
|
||||
update)
|
||||
func=_bash-it_update;;
|
||||
*)
|
||||
reference bash-it
|
||||
return;;
|
||||
|
|
@ -115,6 +118,27 @@ _bash-it-plugins ()
|
|||
_bash-it-describe "plugins" "a" "plugin" "Plugin"
|
||||
}
|
||||
|
||||
_bash-it_update() {
|
||||
_about 'updates Bash it'
|
||||
_group 'lib'
|
||||
|
||||
cd "${$BASH_IT}"
|
||||
git fetch &> /dev/null
|
||||
local status="$(git rev-list master..origin/master 2> /dev/null)"
|
||||
if [[ -n "${status}" ]]; then
|
||||
git pull --rebase &> /dev/null
|
||||
if [[ $? -eq 0 ]]; then
|
||||
echo "Bash it successfully updated, enjoy!"
|
||||
reload
|
||||
else
|
||||
echo "Error updating Bash it, please, check if your Bash it installation folder (${BASH_IT}) is clean."
|
||||
fi
|
||||
else
|
||||
echo "Bash it is up to date, nothing to do!"
|
||||
fi
|
||||
cd - &> /dev/null
|
||||
}
|
||||
|
||||
_bash-it-describe ()
|
||||
{
|
||||
_about 'summarizes available bash_it components'
|
||||
|
|
@ -355,6 +379,13 @@ _help-plugins()
|
|||
rm $grouplist 2> /dev/null
|
||||
}
|
||||
|
||||
_help-update () {
|
||||
_about 'help message for update command'
|
||||
_group 'lib'
|
||||
|
||||
echo "Check for a new version of Bash it and update it."
|
||||
}
|
||||
|
||||
all_groups ()
|
||||
{
|
||||
about 'displays all unique metadata groups'
|
||||
|
|
|
|||
Loading…
Reference in New Issue