feat(main): added version flag

pull/13/head
kevin zhuang 4 years ago
parent bc98c7892e
commit 1853299eb1

@ -24,7 +24,8 @@ function usage() {
echo -e "dotbare added couple useful scripts starting with 'f' prefix to help you"
echo -e "manage your interact with your git bare repo a little easier with the help of fzf\n"
echo -e "optional arguments:"
echo -e " -h\t\tshow this help message and exit"
echo -e " -h, --help\t\tshow this help message and exit"
echo -e " -v, --version\t\tshow dotbare current version"
echo -e "Available commands:"
echo -e " Any git commands, treat dotbare as git"
echo -e " fadd \t\tstage modified file interactively"
@ -56,10 +57,15 @@ fi
exit 1
case "$1" in
help|-h)
--help|-h)
usage
exit 0
;;
-v|--version)
cd "${mydir}"
printf "Current dotbare version: %s\n" "$(git describe --tags $(git rev-list --tags --max-count=1))"
exit 0
;;
*)
if [[ -x "${mydir}/scripts/$1" ]]; then
exec "${mydir}/scripts/$1" "${@:2}"

@ -2,7 +2,6 @@
#
# update dotbare to latest master
set -e
set -f
mydir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
@ -39,7 +38,7 @@ cd "${mydir}/.."
echo "Updating dotbare ..."
if git pull --rebase --stat origin master; then
echo "dotbare updated successfully"
printf "Current dotbare version: %s\n" $(git describe --tags $(git rev-list --tags --max-count=1))
printf "Current dotbare version: %s\n" "$(git describe --tags $(git rev-list --tags --max-count=1))"
else
echo "Something went wrong, please try again or fire up a issue at https://github.com/kazhala/dotbare"
fi

Loading…
Cancel
Save