Add version to commands
Add a helper to show the current git SHA of the installed git repo. Signed-off-by: Mike Fiedler <miketheman@gmail.com>
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 ] '
|
||||
param '1: verb [one of: help | show | enable | disable | migrate | update | search | version ] '
|
||||
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'
|
||||
@@ -71,6 +71,7 @@ bash-it ()
|
||||
example '$ bash-it migrate'
|
||||
example '$ bash-it update'
|
||||
example '$ bash-it search ruby [[-]rake]... [--enable | --disable]'
|
||||
example '$ bash-it version'
|
||||
typeset verb=${1:-}
|
||||
shift
|
||||
typeset component=${1:-}
|
||||
@@ -90,8 +91,10 @@ bash-it ()
|
||||
return;;
|
||||
update)
|
||||
func=_bash-it_update;;
|
||||
migrate)
|
||||
migrate)
|
||||
func=_bash-it-migrate;;
|
||||
version)
|
||||
func=_bash-it-version;;
|
||||
*)
|
||||
reference bash-it
|
||||
return;;
|
||||
@@ -227,6 +230,19 @@ _bash-it-migrate() {
|
||||
fi
|
||||
}
|
||||
|
||||
_bash-it-version() {
|
||||
_about 'shows current Bash-it version'
|
||||
_group 'lib'
|
||||
|
||||
cd "${BASH_IT}" || return
|
||||
|
||||
echo "Current git SHA:"
|
||||
echo "$(git log --pretty=format:'%h on %aI' -n 1)"
|
||||
|
||||
CURRENT_GIT_SHA=$(git rev-parse --verify HEAD)
|
||||
echo "https://github.com/Bash-it/bash-it/commit/$CURRENT_GIT_SHA"
|
||||
}
|
||||
|
||||
_bash-it-describe ()
|
||||
{
|
||||
_about 'summarizes available bash_it components'
|
||||
|
||||
Reference in New Issue
Block a user