mirror of
https://github.com/outbackdingo/UltraGrid.git
synced 2026-03-21 06:40:15 +00:00
data/make_man.sh: replace getopt with getopts
use of getopt is a bashism and it is also quite cumbersome as a side effect, long options are no longer options
This commit is contained in:
@@ -124,9 +124,9 @@ hd_rum_transcode_man() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
usage() {
|
usage() {
|
||||||
printf "Usage:\n\t$0 [-d|--debug|-h|--help|-k|--keep|-n] [uv|hd-rum-trancode|all]\nwhere\n"
|
printf "Usage:\n\t%s [-d|-h|-k||-n] [uv|hd-rum-trancode|all]\nwhere\n" "$0"
|
||||||
printf "\t-d|--debug - print debug info\n"
|
printf "\t-d - print debug info\n"
|
||||||
printf "\t-k|--keep - keep generated AsciiDoc sources\n"
|
printf "\t-k - keep generated AsciiDoc sources\n"
|
||||||
printf "\t-n - do not generate manpages (can be useful with -k)\n"
|
printf "\t-n - do not generate manpages (can be useful with -k)\n"
|
||||||
printf "\n"
|
printf "\n"
|
||||||
printf "\tname of man page - specify 'all' generate all manual pages\n"
|
printf "\tname of man page - specify 'all' generate all manual pages\n"
|
||||||
@@ -139,43 +139,27 @@ DRY_RUN=
|
|||||||
KEEP_FILES=
|
KEEP_FILES=
|
||||||
VERBOSE=
|
VERBOSE=
|
||||||
|
|
||||||
TEMP=$(getopt -o 'dhkn' --long 'debug,help,keep' -n "$0" -- "$@")
|
while getopts dhkn name; do
|
||||||
|
case $name in
|
||||||
if [ $? -ne 0 ]; then
|
d)
|
||||||
echo 'Terminating...' >&2
|
VERBOSE="-v"
|
||||||
exit 1
|
set -x
|
||||||
fi
|
;;
|
||||||
|
h)
|
||||||
# Note the quotes around "$TEMP": they are essential!
|
usage
|
||||||
eval set -- "$TEMP"
|
exit 0
|
||||||
unset TEMP
|
;;
|
||||||
|
k)
|
||||||
while true; do
|
KEEP_FILES=1
|
||||||
case "$1" in
|
;;
|
||||||
'-d'|'--debug')
|
n)
|
||||||
VERBOSE="-v"
|
DRY_RUN=1
|
||||||
set -x
|
;;
|
||||||
;;
|
?)
|
||||||
'-h'|'--help')
|
usage
|
||||||
usage
|
exit 1
|
||||||
exit 0
|
;;
|
||||||
;;
|
|
||||||
'-k'|'--keep')
|
|
||||||
KEEP_FILES=1
|
|
||||||
;;
|
|
||||||
'-n')
|
|
||||||
DRY_RUN=1
|
|
||||||
;;
|
|
||||||
'--')
|
|
||||||
shift
|
|
||||||
break
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
echo 'Internal error!' >&2
|
|
||||||
exit 1
|
|
||||||
;;
|
|
||||||
esac
|
esac
|
||||||
shift
|
|
||||||
done
|
done
|
||||||
|
|
||||||
if [ $# -eq 0 ]; then
|
if [ $# -eq 0 ]; then
|
||||||
|
|||||||
Reference in New Issue
Block a user