summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rwxr-xr-xsrc/adoc24
1 files changed, 23 insertions, 1 deletions
diff --git a/src/adoc b/src/adoc
index 85d2387..b52dd60 100755
--- a/src/adoc
+++ b/src/adoc
@@ -3,9 +3,31 @@ set -euo pipefail
usage() {
- echo 'Usage: adoc [-x] [-s] [-n INDENT_LEN] [FILENAME.adoc]'
+ echo 'Usage: adoc [-x] [-s] [-n INDENT_LEN] FILENAME.adoc'
}
+EXTRACT_CODE=false
+STANDALONE=false
+INDENT_LEN=0
+while getopts 'xsn:' flag; do
+ case "$flag" in
+ (x)
+ EXTRACT_CODE=true
+ ;;
+ (s)
+ STANDALONE=true
+ ;;
+ (n)
+ INDENT_LEN="$OPTARG"
+ ;;
+ (*)
+ usage >&2
+ exit 2
+ ;;
+ esac
+done
+shift $((OPTIND - 1))
+
FILENAME="${1:-}"
eval "$(assert-arg -- "$FILENAME" 'FILENAME.adoc')"