Skip to content
This repository has been archived by the owner on Apr 26, 2021. It is now read-only.

Discussion: do we need laxPlacement? #90

Open
felixSchl opened this issue Feb 16, 2017 · 1 comment
Open

Discussion: do we need laxPlacement? #90

felixSchl opened this issue Feb 16, 2017 · 1 comment

Comments

@felixSchl
Copy link
Owner

I am re-working the argparser again, still not being a 100% satisfied with the current behavior. This time I've decided to completely neglect the idea of laxPlacement and instead use it as the default behavior, meaning options can appear anywhere in the input, while still respecting "options-first" parsing, "--" and unknown option parsing. Among 1400 odd tests only a single test would fail due to this behavior, making me wonder the validity of bothering to even keep the old behavior. I saw value - originally - to be able to add options in particular regions of the command line to - in a way - configure subcommands, but in reality there's only a single [options] tag (until #57 comes to fruition - if ever) and composition of larger command lines probably means that each subcommand would want it's own help (like the git example).

Hence I am compelled to abandon the idea and rely on downstream users composing their programs accordingly to achieve a similar effect (using the "options-first" feature).

NB: These changes will go into version 2 of neodoc so I am happy to break backwards compatibility here to a level.

@fidian
Copy link

fidian commented Jun 27, 2019

I've exclusively used laxPlacement: true in all of my projects. Usually, I define my command like this:

some-command [options] <categoryId> <action>

I always want the option --config file.json to appear in any place.

./some-command --config file.json jewelry show
./some-command jewelry --config file.json show  # weird, but ok
./some-command jewelry show --config file.json

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants