GaretJax / django-click

Write Django management command using the click CLI library
MIT License
251 stars 20 forks source link

click.exceptions.MissingParameter: None #4

Closed trawick closed 7 years ago

trawick commented 8 years ago

click==6.6, django-click==1.2.0, django==1.5.12

If the one required parameter is omitted from the following management command, the user sees the error message in the subject of this issue

import djclick as click

@click.command()
@click.argument('name')
def command(name):
   click.secho('Hello, {}'.format(name), fg='red')

If the one required parameter is omitted from the following command, the user sees a better error message.

import click

@click.command()
@click.argument('name')
def hello(name):
    click.secho('Hello, {}'.format(name), fg='red')

if __name__ == '__main__':
    hello()
$ python foo.py 
Usage: foo.py [OPTIONS] NAME

Error: Missing argument "name".

Any ideas? This would seem to be a django-click issue?

GaretJax commented 8 years ago

Maybe because of the handling here: https://github.com/GaretJax/django-click/blob/master/djclick/adapter.py#L21

Good catch though, will need to add a test case for it. :-)

GaretJax commented 7 years ago

Hi @trawick A fix for this has finally been released (v2.0.0)

trawick commented 7 years ago

Awesome, I saw the commit yesterday but didn't have time to play yet. I'm looking forward to updating the various projects where I've included django-click :) Thanks!