Quantcast
Channel: Active questions tagged python - Stack Overflow
Viewing all articles
Browse latest Browse all 18848

How to use a renamed variable for a click option?

$
0
0

I want to use click to specify an option, but I want to access the value in a differently named variable.

So here is what I have

@click.command()@click.option("--all",    is_flag=True,    help="This will use all of it.",)def mycode(all):    ...

But this would override the built-in function all. So in order to avoid that I am looking for a way so a different variable is used for the main code, i.e.

@click.command()@click.option("--all",    is_flag=True,    alias="use_all"    help="This will use all of it.",)def mycode(use_all):    ...

But the documentation on click.option seems very sparse/misses everything/I am looking at the wrong thing?

So how to do it?


Viewing all articles
Browse latest Browse all 18848

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>