i’m not going to expound on this too much, except to say that the way Swift ArgumentParser handles single dash-prefixed arguments differently from double dash-prefixed arguments is incredibly confusing.
sample command:
$ archer crush .build.wasm/release/ECMAScriptTest.wasm \
-o Bundle/main.wasm \
-Xwasm-opt --enable-threads
Error: Missing value for '-o <output>'
Help: -o <output> Where to write the optimized WebAssembly (wasm) binary
Usage: archer crush [<wasm-file>] [--output <output>] [--Xwasm-opt <Xwasm-opt> ...] [--preserve-debug-info]
See 'archer crush --help' for more information.
i think the expansion of -abc
into -a -b -c
is a GNU-ism that really ought to be opt-in rather than opt-out.
it’s really non-obvious that the spelling error in that example is -Xwasm-opt
instead of --Xwasm-opt
, and even less obvious that this is caused by a customLong(withSingleDash:)
configuration error in the command line application itself.
related: Why does Swift treat double dash command line arguments differently?