switch -v to -d and added new version info

This commit is contained in:
James Tomasino 2018-01-20 16:41:37 -05:00
parent bb609ca0e3
commit 532e067463
2 changed files with 13 additions and 8 deletions

16
burrow
View File

@ -1,6 +1,6 @@
#!/usr/bin/env bash
# v1.0.0rc
version="v1.0.0rc"
shopt -s extglob
configfiles="$HOME/.config/burrow/config $HOME/.config/burrow $HOME/.burrow"
editor=${EDITOR:-vi}
@ -16,7 +16,7 @@ config_git_commit=false
config_git_push=false
# vars from flags
flag_verbose=0
flag_debug=0
# vars from args
arg_recipe=0
@ -35,8 +35,9 @@ create-config - create a default configuration file
update-git - silently pulls gopher git repo if it exists
OPTIONAL FLAGS:
help [-h] - show this help
verbose [-v] - verbose logging
-h - show this help
-v - show current version info
-d - debug mode
END
}
@ -50,14 +51,15 @@ popd () {
}
function parseopts() {
while getopts ":hv" opt
while getopts ":hvd" opt
do
case "${opt}" in
h)
show_help
exit 0
;;
v) flag_verbose=1 ;;
d) flag_debug=1 ;;
v) echo "$version" ;;
*)
echo "Invalid option. Try -h for help."
exit 1
@ -280,7 +282,7 @@ function main() {
parseopts "$@"
parseargs "${@:$?}"
if [[ ${flag_verbose} -gt 0 ]]
if [[ ${flag_debug} -gt 0 ]]
then
set -x
fi

View File

@ -28,7 +28,10 @@ silent
which is useful for crons.
.TP
.B -v
Enable verbose logging.
Display current version information.
.TP
.B -d
Debug mode.
.TP
.B -h
Show the help.