I am having trouble with command groups. I have been following this guide.
#!/usr/bin/env python
import click
@click.group()
@click.option("--template-id", prompt="Template ID", help="The template to use.")
@click.option("--lang", prompt="Langcode", help="The language to use.")
def cli(template_id, lang):
pass
@cli.command()
@click.argument('template-id')
@click.argument('lang')
def upload_translations(template_id, lang):
pass
if __name__ == "__main__":
cli()
Running this causes problems:
» ~/cli.py upload_translations --template-id=xxxxx --lang=ja
Template ID: sdf
Langcode: asdf
Error: no such option: --template-id
- Why is click requesting the options? I am already passing that on the command line!
- Why is there an Error:
no such option: --template-id?