Improve argument check
This commit is contained in:
53
showtags
53
showtags
@@ -1,45 +1,60 @@
|
||||
#! /bin/bash
|
||||
#
|
||||
asciiMonth=0
|
||||
while [ $# != 0 ]; do
|
||||
case "$1" in
|
||||
-h | -\? | --help)
|
||||
echo "usage: showtags [-a] [-s]"
|
||||
# $Source: /cvs/G/EPICS/App/scripts/showtags,v $
|
||||
# $Revision: 1.11 $ $Date: 2006/12/08 08:09:18 $
|
||||
#----------------------------------------------------
|
||||
# Check the command line
|
||||
#
|
||||
opts=$(getopt -n showtags ahvs $*)
|
||||
if [ $? != 0 ]; then echo Try: -h; exit; fi
|
||||
#
|
||||
# Command line is OK, so set the args and continue.
|
||||
#
|
||||
set -- $opts
|
||||
|
||||
asciiMonth=0
|
||||
|
||||
while [ $# != 0 ]; do
|
||||
case "$1" in
|
||||
-h | -\? | --help)
|
||||
echo "usage: showtags [-a] [-s] [-h] [-v]"
|
||||
echo " Find CVS tags in this directory and subdirectories."
|
||||
echo " If there is a connection to psip0 (Oracle 9) you get date and time info too."
|
||||
echo " Specify -a to get months displayed as abbreviated text string."
|
||||
echo " Specify -s to get the tagged status of files in the directory."
|
||||
exit 0
|
||||
;;
|
||||
-v | --version)
|
||||
-v | --version)
|
||||
echo 'Original Author: Dirk Zimoch'
|
||||
echo 'Last Change by $Author: maden $'
|
||||
echo '$Revision: 1.10 $ $Date: 2006/12/08 07:37:31 $'
|
||||
echo '$Revision: 1.11 $ $Date: 2006/12/08 08:09:18 $'
|
||||
echo '$Source: /cvs/G/EPICS/App/scripts/showtags,v $'
|
||||
exit 0
|
||||
;;
|
||||
-a)
|
||||
-a)
|
||||
# Display months as abbreviated month strings, not as numbers.
|
||||
asciiMonth=1
|
||||
;;
|
||||
-s)
|
||||
-s)
|
||||
# Show the tagged status of the directory.
|
||||
tagStatus
|
||||
exit $?
|
||||
;;
|
||||
-*)
|
||||
echo "Unknown option $1. Try: -h, --help, -v, --version, -a"
|
||||
--)
|
||||
;;
|
||||
*)
|
||||
echo "Invalid argument $1. Try: -h"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
trap "stty echo" EXIT SIGTERM SIGKILL
|
||||
esac
|
||||
shift
|
||||
done
|
||||
trap "stty echo" EXIT SIGTERM SIGKILL
|
||||
|
||||
TAGS=$(cvs status -v 2>/dev/null | awk '
|
||||
/\(revision:/ {tag[$1]=1}
|
||||
END {for (i in tag) { print i}}
|
||||
')
|
||||
TAGS=$(cvs status -v 2>/dev/null | awk '
|
||||
/\(revision:/ {tag[$1]=1}
|
||||
END {for (i in tag) { print i}}
|
||||
')
|
||||
|
||||
function jointags()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user