These are chat archives for kbknapp/clap-rs

7th
Feb 2018
Peter TB Brett
@peter-b
Feb 07 2018 22:12
Hi all. What's the recommended way to provide "opposite flags" with clap, e.g. --fizzle vs --no-fizzle, where the last one specified "wins"?
Kevin K.
@kbknapp
Feb 07 2018 22:43
@mwalczyk apologies, I switched phones and didn't see these messages
@peter-b use Arg::overrides_with
You only need to specify that on one, because it goes both was
Ways*
Peter TB Brett
@peter-b
Feb 07 2018 22:44
Thanks, I'll look at it!
I'm on mobile or I'd give a better example :P
Peter TB Brett
@peter-b
Feb 07 2018 22:46
So I gathered :P
Kevin K.
@kbknapp
Feb 07 2018 22:46
@mwalczyk is it always two values? Or is it a variable length?
Peter TB Brett
@peter-b
Feb 07 2018 22:46
So I'd set up --fizzle and --no-fizzle as an override set, and then only check the flag for --fizzle
Kevin K.
@kbknapp
Feb 07 2018 22:47
Yep! If that doesn't work, it'd be a bug
Peter TB Brett
@peter-b
Feb 07 2018 22:47
Thank you! clap is great, thank you for your hard work on it
Kevin K.
@kbknapp
Feb 07 2018 22:48
Thank! :)
Thanks*
Peter TB Brett
@peter-b
Feb 07 2018 22:48
(Beats the stuffing out of any of the argument parsing libs I've used in Pythoon)
Kevin K.
@kbknapp
Feb 07 2018 22:48
Rust makes it a little easier to do all these extra features from the pyrhin libs I've used
Granted it is a little more verbose, but I think it's worth it
Weve switched a lot of our python utilities at work to Rust, and it's that exact use case that got me making this
Peter TB Brett
@peter-b
Feb 07 2018 23:02
What was the main advantage of Rust that enabled you to allocate resources to rewriting tools that worked?
(Getting stakeholder buy-in for refactoring/rewriting internal tools is pretty hard in my experience!)
Kevin K.
@kbknapp
Feb 07 2018 23:13
For us (which is a different environment than a lot) it was the speed and garuntees that a statically typed language gives you. At the same time we had started using Go, but Rust provided more flexibility in building components we reuse between these utilities
Peter TB Brett
@peter-b
Feb 07 2018 23:14
That's interesting, thanks