summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2025-04-03 11:06:32 -0300
committerEuAndreh <eu@euandre.org>2025-04-03 11:15:38 -0300
commit71f4664a53910d7158d127c7892ca03eaf20f424 (patch)
tree4129e2215ffb7d0c2a7b5d2c04c2ca9f86d7cf65
parentsrc/adoc: Import code from blog (diff)
downloadadoc-71f4664a53910d7158d127c7892ca03eaf20f424.tar.gz
adoc-71f4664a53910d7158d127c7892ca03eaf20f424.tar.xz
src/adoc: Add (unused) getops options
-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')"