diff options
| author | Ralph Amissah <ralph.amissah@gmail.com> | 2026-09-30 10:51:57 -0400 |
|---|---|---|
| committer | Ralph Amissah <ralph.amissah@gmail.com> | 2026-09-30 19:54:50 -0400 |
| commit | be8a7632289f052b35ff1d7be7dc2142724f6107 (patch) | |
| tree | 5c1c19ba3e44aa40482b02f1c2e7ea9c19aef0e5 /src/sisudoc | |
| parent | 0.25.1 (diff) | |
options: request absent flag, warn; --strict fails
unrecognised options are named on stderr before any work is done, and
--strict makes such fatal (exit 1). (prior to this commit a mistyped
or retired flag was ignored without acknowledgement). This applies to
options only, an argument that is not a source, such as a README beside
pods being processed, is still passed over quietly.
(assisted by Claude-Code)
Diffstat (limited to 'src/sisudoc')
| -rw-r--r-- | src/sisudoc/spine.d | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/sisudoc/spine.d b/src/sisudoc/spine.d index db6c8ac..e1e5d62 100644 --- a/src/sisudoc/spine.d +++ b/src/sisudoc/spine.d @@ -395,6 +395,19 @@ string program_name = "spine"; if (opts["po4a-cfg"]) { _run_banner = false; } + /+ ↓ an option getopt did not recognise +/ + { + string[] _unknown_options + = args[1..$].filter!(a => a.length > 1 && a[0] == '-').array; + foreach (_o; _unknown_options) { + stderr.writeln("WARNING: option not recognised, ignored: ", _o); + } + if (_unknown_options.length > 0 && opts["strict"]) { + stderr.writeln("~ run FAILED ~ --strict: option not recognised"); + import core.stdc.stdlib : exit; + exit(1); + } + } if (helpInfo.helpWanted) { /+ ↓ the undocumented alias is registered so that it still works, and is not listed, so that --ocda-db is the one flag the help offers |
