Closed naved001 closed 5 years ago
Might be a little slow getting to this one (and probably generally less responsive this week); I blocked off a fair chunk of time to work on other projects this week.
Just want to finish this quickly since a lot of people have been asking for a good interface. Question for reviewers (@zenhack @ianballou)
--jsonout
, I want to use --json
but I can't because we import json
. What's the best way to accomplish this? (I could just import json as something else, but not sure if it's pythonic or not).My opinions:
1) Does the flag text string really need to be the same as the variable name? I feel like regardless of whether or not we import json
as json
shouldn't affect the strings we use for cli flags.
2) I think we should push what we have first and then make another PR.
Adding to (1):
There is a way to have a different variable name from the CLI flag string. Essentially you exploit the fact that Click will prioritize using arguments without dashes. The variable name follows whatever argument you put in the decorator that doesn't have --
, but you can still use --json
along with the dash-less one. Here's a link that shows this in more detail: https://stackoverflow.com/a/35574063
@ianballou thanks for 1. Figured it out now.
I'm pretty sure I'm all good with this, I'll give a thumbs up when the json jsonout bit is changed
I'm pretty sure I'm all good with this, I'll give a thumbs up when the json jsonout bit is changed
okay, done.
LGTM
Credit to @RobinKaul for doing all this work. The original PR #1040 has some messed up commit history, so I am starting a new one.
In the next few commits I'll address @zenhack and @ianballou's comments (and mine too).