These are chat archives for kbknapp/clap-rs

14th
Sep 2017
Kevin K.
@kbknapp
Sep 14 2017 04:00
I believe the way it's written right now passing in without a value, but having a default value set will cause clap to set the default value, not zero it out
which I believe is the more intuitive route
I had to step away for work for a few hours, but I just fixed up that PR and it should be good for a merge now
2.26.1 will fix the long_about issue and the require_equals(true).min_values(0) bugs
Jon Gjengset
@jonhoo
Sep 14 2017 05:07
@kbknapp yes, it looks good. for require_equals(true).min_values(0).default_value(), is there a way to see whether the user supplied the given argument or not? occurences_of maybe?
also, we should probably file an issue for clap showing SUBCOMMANDS when there are no subcommands
and also for it including the help subcommand if there are no other visible subcommands
I'm guessing these last two are actually both the same bug: not ignoring hidden subcommands when counting
Kevin K.
@kbknapp
Sep 14 2017 05:18
Yep, I totally forgot about the subcommands thing, I'll try and knock that one out tomorrow
As for user supplied values, the occurrences_of should work fine, if it's 0 the user didn't use it, but it should still have the default value
Kevin K.
@kbknapp
Sep 14 2017 14:39
v2.26.1 is out
Jon Gjengset
@jonhoo
Sep 14 2017 14:40
:tada:
thanks!
Kevin K.
@kbknapp
Sep 14 2017 14:41
no probs. I'll be kinda busy with my day job today, but I'll see if I can get to this subcommand issue
Jon Gjengset
@jonhoo
Sep 14 2017 14:42
no rush now that I don't use them
maybe just file an issue?
and then deal with it later
Kevin K.
@kbknapp
Sep 14 2017 14:42
yeah if you wouldn't mind throwing it on the issue tracker that'll help! :)
Jon Gjengset
@jonhoo
Sep 14 2017 14:43
hmm, require_equals(true).min_values(0).default_value() unfortunately doesn't seem to work :/
as in, matches.value_of("arg") is None
given program --arg
Kevin K.
@kbknapp
Sep 14 2017 14:44
ah no! I thought I added a test for that....maybe I got side tracked :worried:
Could you throw that on the issue tracker too? And I'll do my best to get to it later today
Since that is a little more urgent
Also, could you test program --arg --otherarg
There was an old bug where if the option is at the end of argv, clap thinks it's an empty value
where --arg is your option with require_equals(true).min_values(0).default_value()
Jon Gjengset
@jonhoo
Sep 14 2017 14:46
nope, doesn't fix it
I'll file issues for both
Kevin K.
@kbknapp
Sep 14 2017 14:46
ok, that's actually good and means it'll be easier to fix
thanks!
Jon Gjengset
@jonhoo
Sep 14 2017 14:52
#1046
Kevin K.
@kbknapp
Sep 14 2017 14:52
:+1:
Jon Gjengset
@jonhoo
Sep 14 2017 15:01
#1047
Kevin K.
@kbknapp
Sep 14 2017 17:40
Turned out I had a little time, so I snuck #1048 in which fixes those issues, I'll upload v2.26.2 once these tests pass
Jon Gjengset
@jonhoo
Sep 14 2017 17:42
:+1:
Jon Gjengset
@jonhoo
Sep 14 2017 19:30
@kbknapp looks like all tests passed for #1048