Repository navigation
Fix ExtrasError. - #49
Conversation
|
I'll look into this in more detail when I get a chance in the next day or two, but not surprised - that code was added very recently. I really need a series of more complex subcommsnd tests that mix features... |
Codecov Report
@@ Coverage Diff @@
## master #49 +/- ##
==========================================
- Coverage 100% 99.67% -0.33%
==========================================
Files 9 9
Lines 1230 1235 +5
Branches 248 248
==========================================
+ Hits 1230 1231 +1
- Misses 0 4 +4
Continue to review full report at Codecov.
|
608ddfc to
bcb6528
Compare
|
I've added a fix for the subcommand ordering, as well. |
|
I think By the way, the main purpose for fallthrough is to allow something like this: ./run_model model1 --common-opt --model1-optto work, where common options can be set on |
|
Thanks! |
|
FYI, Windows requires |
I noticed that ExtrasError wasn't showing the extra argument in a subcommand. So I dug deeper, and I could identify a bug in remaining(true), which was overwriting the miss_list instead of extending it. So, I added some tests and fixed it.
But then I noticed some bargled logic in triggering ExtrasError: Firstly, there is a mismatch between remaining(true) and remaining_size() (without true). Secondly, it didn't handle allow_extras_ and prefix_command_ on a per-subcommand basis. I tried a couple of things, but the easiest fix was to just let each subcommand fail on its own, by not using recurse=true at all.
As recurse=true is not used anymore (and because it does not handle allow_extras_ and prefix_command_), the recurse=true case could be removed from the code base. My patch doesn't do that, though, to keep the change minimal, in case there are some other plans or cases I missed. My recommendation would be to remove it if it doesn't serve any other purpose. I am not firm on the logic behind the fallthrough_ cases, so it may be that I am missing something.