aboutsummaryrefslogtreecommitdiff
path: root/src/wrappers/getopts.sh
diff options
context:
space:
mode:
Diffstat (limited to 'src/wrappers/getopts.sh')
-rw-r--r--src/wrappers/getopts.sh12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/wrappers/getopts.sh b/src/wrappers/getopts.sh
new file mode 100644
index 000000000..263263c07
--- /dev/null
+++ b/src/wrappers/getopts.sh
@@ -0,0 +1,12 @@
+if [ -z "$SYNOPSIS" ]; then
+ SYNOPSIS="[-h] [input_file]"
+ [ -n "$THIS_NARG" ] || SYNOPSIS="${SYNOPSIS}..."
+fi
+
+while getopts h opt; do
+ case $opt in
+ h|?) usage "$SYNOPSIS"; exit 2 ;;
+ esac
+done
+
+shift $(($OPTIND - 1))