add version number, -V to print it

This commit is contained in:
Dave Eddy 2018-11-12 13:07:26 -05:00
parent d20393bb75
commit 2b417b46a5
2 changed files with 7 additions and 1 deletions

View File

@ -80,7 +80,9 @@ Usage
-h print this message and exit
-n dry-run, don't actually delete snapshots
-p <prefix> snapshot prefix string to match
-q quiet, do not printout removed snapshots
-v increase verbosity
-V print the version number and exit
License
-------

View File

@ -6,6 +6,8 @@
# Date: November 20, 2015
# License: MIT
VERSION='v1.0.0'
usage() {
local prog=${0##*/}
cat <<-EOF
@ -48,6 +50,7 @@ usage() {
-p <prefix> snapshot prefix string to match
-q quiet, do not printout removed snapshots
-v increase verbosity
-V print the version number and exit
EOF
}
@ -91,13 +94,14 @@ dryrun=false
verbosity=0
prefix=
quiet=false
while getopts 'hnqp:v' option; do
while getopts 'hnqp:vV' option; do
case "$option" in
h) usage; exit 0;;
n) dryrun=true;;
p) prefix=$OPTARG;;
q) quiet=true;;
v) ((verbosity++));;
V) echo "$VERSION"; exit 0;;
*) usage; exit 1;;
esac
done