Perhaps this latest change helps you.
https://github.com/factor/factor/commit/666a44bfc2b24b811bfde3a971e09a56ae7ad581
If you define your commands list ("add", "subtract"):
https://paste.factorcode.org/paste?id=4743
You can see that it works more-or-less as you expect:
$ ./factor foo.factor
$ ./factor foo.factor --help
Usage:
factor foo.factor [--help] [command]
Arguments:
command {add,subtract}
Options:
--help show this help and exit
$ ./factor foo.factor add --help
Usage:
factor foo.factor add [--help] [a]
Arguments:
a
Options:
--help show this help and exit
$ ./factor foo.factor multiply
ERROR: Invalid value 'multiply' for option 'command'
I think the command-line.parser vocab works as-is, but it's a little unwieldy
and maybe more fragile than it should be. Improvements and PRs welcome.
Let me know how that works (or not) for you.
Thanks,
John.
> On Jul 7, 2025, at 12:08 PM, toastal <[email protected]> wrote:
>
> It is pretty close, but the thing with command-line.parser, is that you
> can get --help (& in the future, command line completions, manpages,
> etc.) for free if following its API. That was the part that the big
> appeal over just coding my own over a switch statement.
>
>
> _______________________________________________
> Factor-talk mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/factor-talk
_______________________________________________
Factor-talk mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/factor-talk