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

View File

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