-
Notifications
You must be signed in to change notification settings - Fork 9
Add a mode that collects unknown options #42
Comments
@felixSchl I would find this useful to allow "global" flags to appear anywhere in the input, and delegating everything else to the subcommand. |
Incidentally, I find it somewhat odd that the behavior of exiting and printing things in the case of errors isn't represented by a data structure I can do something else with. That would allow me to more easily implement this functionality myself 😄 (it also makes it harder to test neodoc-based CLIs) |
That is such a good point 👍 ... I don't want to bore you with the details, but I think I will have to finally let go of using
funny you'd bring it up, I had my fair share of pain w/ it, too: Lines 17 to 59 in a20f8e3
I think those tests can remain, but they should be complementary. |
@felixSchl yeah I found Lines 24 to 25 in a20f8e3
I'm glad I did 😄 For what it's worth, I'm one of the authors of the Cargo package manager and we used docopt in Cargo (I also wrote Thor, which is one of the more popular command-line utilities in Ruby), so I was looking for a good option in JS for a project I'm working on. I came across Let me know what I can do to help! |
That's one impressive portfolio you have. I'd be glad to work together to make neodoc what you need it to be. I am sure potential adopters would only benefit from this. I have again resumed work at full steam, but before hacking on the arg parser, I am paying off some of the technical debt I accrued essentially shooting down #74, #67, prepare for #57, make #56 redundant, prepare for #38. It should make #23 also a bit easier and #69... I have not pushed any of that work yet, but essentially I am moving to a data structure that can be transformed, i.e.: type Branch a = NonEmpty List (Layout a)
data Layout a
= Group Repeatable Optional (NonEmpty List (Branch a))
| Elem a This way |
I am almost through with the refactor to the aforementioned data structure, just a couple of modules that need re-wiring and code updates. I also chose to re-implement the arg parser using a custom monad in order to get better error handling, effectively being able to handle your usecase (with 80% or so code overlap, because purescript is awesome). A nice side effect is that it likely will also run faster. There's still a good chunk of work to be done, but I have the next couple of days of full time available to myself to work on this, so I think we'll be in a good position by the end of the week. |
@wycats this, alongside repeatable options (#32) has been implemented. Repeatable options are available in the 1.0 release with Lines 3562 to 3566 in 1509f6b
|
This feature is now available with version 1.3.0 |
Add a mode that, instead of failing a parse, collects unknown options into an array with a special key: '?'.
The usecase is passing unknown options to another program.
The text was updated successfully, but these errors were encountered: