> Regardless of whether going ``foo add`` or ``foo substract`` there is > still value is top-level flags beyond ``--help`` — namely ``--version``. > I wouldn’t expect to need to add ``--version`` flags to both ``add`` & > ``subtract``, & while I could, downstream users would be confused that > they need to use ``foo add --version`` or ``foo substract --version``, > but not ``foo --version``. As a developer, I need to choose to opt into > ``with-commands`` or ``with-options`` as either will fail if parsing > came up blank. I can assume there is a try-catch mechanism that could be > used to run ``with-options`` first for top-level, then try > ``with-commands``, but that doesn’t seem like the intended UX but a > hack.
Some good points. I guess I would say: It likely does needs to be extended to support top-level options. The developer would typically know if they want sub-commands and opt-into the specific parser they want. Argument parsing is a deep topic and few libraries fit all use cases. I had hesitated to promote command-line.parser to basis/ as it feels a little clunky, which is partly due to inheriting the clunky-ness that python's ArgumentParser contained. I've wanted a docopt style parser for Factor, for awhile. See http://docopt.org/ for more info. Contributions welcome! If you come up with improvements, please let us know. Thanks, John.
_______________________________________________ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk