Closed lethal-guitar closed 2 years ago
This is unexpected.. i.e. a bug. Thanks for reporting it. I'll put this on the top of my queue for fixing.
Hi @grafikrobot, hope you're doing well. Was just wondering if you already had a chance to look into this?
Hey @lethal-guitar .. I have been working on it since first posted. And I did have a solution early. Unfortunately I broke backwards compat along the way. Which I've been, rather slowly, working to fix.
Ah that's good to hear. Yeah backwards compatibility can be a tricky thing.. Thanks for the update!
And it took way, way, longer than I expected. But I have it fixed. Just need to clean up code and such.
@grafikrobot awesome! 👍🏻🎉
Hi, I'm in the process of migrating my project to Lyra, and I've encountered some surprising behavior of the "group" feature where I'm not sure if it is intentional.
Specifically, it seems that as soon as I specify an option belonging to a group, the very next subsequently given option will always be treated as a positional argument even if it should instead be matched by another option. This is easiest to explain by example. Consider the following program (ready for copy & paste and build):
Expected behavior
If I invoke the program and specify the
-f
option after--req-in-group
, I would expect it to result in settingsomeFlag
, and a subsequent positional argument to be assigned topositionalArg
.Expected output:
Expected output without positional arg:
Actual behavior
What actually happens is that
-f
is assigned topositionalArg
:And adding a subsequent positional argument (i.e.
--req-in-group test1 -f test2
) results in a parse error (unrecognized token: test2
).Interestingly, specifying the positional argument first after the group argument results in the behavior I would expect:
This seems like a bug to me, but maybe I'm misunderstanding something about how groups work? Any clarification would be appreciated 🙂 I really like the groups feature and would love to use it!