Skip to content

click.Choice text wrap #202

Closed
Closed
@uSpike

Description

@uSpike

Choice arguments are not printed very nicely with a large number of options.

OPTIONS=[
'option000',
'option001',
'option002',
'option003',
'option004',
'option005',
'option007',
'option001',
'option009',
'option010',
'option011',
'option012',
'option013',
]
arg_board = click.argument('board', type=click.Choice(OPTIONS))

@click.group()
def cli0():
    pass

@cli0.command()
@arg_board
def login(board, server):
    """ Login to a board """
    pass

produces

$ ./test0 login
Usage: test0 login [OPTIONS] BOARD

Error: Missing argument "board".  Choose from option000, option001, option002, option003, option004, option005, option007, option001, option009, option010, option011, option012, option013.

Using the textwrapper to separate options by line would make for cleaner and more readable output.

$ ./test0 login
Usage: test0 login [OPTIONS] BOARD

Error: Missing argument "board".  Choose from:
        option000
        option001
        ...

Also from http://click.pocoo.org/arguments/

Click will also not attempt to document arguments for you and wants you to document them manually in order to avoid ugly help pages.

How does one insert help text for an argument?

Thank you.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions