Skip to content

Cannot pass negative numbers as arguments #555

@Kitchi

Description

@Kitchi

If I try to pass a negative number to click, it interprets it as an option. This happens when I define the number either as int, float or leave it to default to string.

Here's a tiny example to illustrate the issue


import click

@click.command()
@click.argument('number', type=float)
def main(number):
    print(number)

if __name__ == '__main__':
    main()

and I run it as

❯ python tmp.py '-10'
Error: no such option: -1

or even as

❯ python tmp.py -10
Error: no such option: -1

EDIT: I am running Python 3.5.1 and Click version 6.3 installed through the Anaconda python distribution.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions