Rename python click argument
<p>I have this chunk of code:</p>

<pre><code>import click

@click.option('--delete_thing', help="Delete some things columns.", default=False)
def cmd_do_this(delete_thing=False):
    print "I deleted the thing."
</code></pre>

<p>I would like to rename the option variable in <code>--delete-thing</code>. But python does not allow dashes in variable names. Is there a way to write this kind of code? </p>

<pre><code>import click

@click.option('--delete-thing', help="Delete some things columns.", default=False, store_variable=delete_thing)
    def cmd_do_this(delete_thing=False):
        print "I deleted the thing."
</code></pre>

<p>So <code>delete_thing</code> will be set to the value of <code>delete-thing</code></p>

<p>By default, click will intelligently map intra-option commandline hyphens to underscores so your code should work as-is. This is used in the click documentation, e.g., in the <a href="http://click.pocoo.org/5/options/#choice-options" rel="nofollow">Choice example</a>. If --delete-thing is intended to be a boolean option, you may also want to make it a <a href="http://stackoverflow.com/questions/40132694/gradientboostingclassifier-analog-in-r">boolean argument</a>.</p>

python command-line-arguments python-click