These are chat archives for kbknapp/clap-rs

Jul 2018
Jul 22 2018 18:46
I'm curious how I can get the program to quit after printing the default help message.
That is, to stop the program from running if --help is passed.
Denis Lisov
Jul 22 2018 18:49
@Serentty It does that by default, doesn't it?
Jul 22 2018 18:51
Oh, I realized my issue. It seems that it doesn't properly print the help message if I parse the arguments within a lazy_static! macro.
I'm not sure how to fix that, though, since I'm assigning the data that I parse into fields in a static struct.
Well, there's the really hacky solution of simply calling the function to parse the arguments twice (once inside the macro and once in main()), and that does seem to work.
Kevin K.
Jul 22 2018 18:55
Interesting. If you've got a link to your code we might be able to find something better
Jul 22 2018 18:56
This is a pull request that I'm working on, so I'll just put this up as a Gist.
This is the relevant part of the code.
Jul 22 2018 19:11
Well, my solution is really hacky, but it seems to work perfectly. I might just stick with that in the meantime.