diff options
author | EuAndreh <eu@euandre.org> | 2025-04-03 11:06:32 -0300 |
---|---|---|
committer | EuAndreh <eu@euandre.org> | 2025-04-03 11:15:38 -0300 |
commit | 71f4664a53910d7158d127c7892ca03eaf20f424 (patch) | |
tree | 4129e2215ffb7d0c2a7b5d2c04c2ca9f86d7cf65 | |
parent | src/adoc: Import code from blog (diff) | |
download | adoc-71f4664a53910d7158d127c7892ca03eaf20f424.tar.gz adoc-71f4664a53910d7158d127c7892ca03eaf20f424.tar.xz |
src/adoc: Add (unused) getops options
-rwxr-xr-x | src/adoc | 24 |
1 files changed, 23 insertions, 1 deletions
@@ -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')" |