Add edge case to remove duplicate help arguments#288
Conversation
|
Thanks for taking this on, @Mark-McCracken! We need a bit of a different approach than what you've taken here, since commands are free to define different names for the Instead, I think we could look at making changes to the |
|
Thanks so much for the feedback! |
|
@Mark-McCracken I resolved this issue in #309 — it ended up being a little more involved than I expected. Thanks again for looking at tackling this, and please let me know if I can help with any other issues you'd like to take on! |
|
Hi Nate, thanks so much, really sorry I didn't get any further with it, I did dig into it a bit, but found that the HelpCommand was actually getting a different input in the first place, and had a bit of a hard time with debugging it. |
Resolves #259
Literally ignores any --help flag, if the first argument is help.
I did spend a while digging into the behaviour using the debugger, but this code is fairly complex, and adding an edge case at this low level would make it harder to understand I think. This ultimately is a little hacky, but I think better than making that low level complexity more complex.
FYI, it was happening somewhere in this function:
swift-argument-parser/Sources/ArgumentParser/Parsing/CommandParser.swift
Line 155 in 831ed5e
If you add a breakpoint on the next line, run the program, continue program execution 2 times, then the
firstUnusedproperty jumps from 1 to 3, skipping the unused commands, causing our bug.Checklist