Packages

Click

Inputs

Click primarily takes two forms of inputs Options and arguments. I think of options as keyword argument and arguments as regular positional arguments.

Option

  • typically aliased with a shorthand ('-v', '--verbose')

**From the Docs

To get the Python argument name, the chosen name is converted to lower case, up to two dashes are removed as the prefix, and other dashes are converted to underscores.


@click.command()
@click.option('-s', '--string-to-echo')
def echo(string_to_echo):
    click.echo(string_to_echo)

@click.command()
@click.option('-s', '--string-to-echo', 'string')
def echo(string):
    click.echo(string)

Argument

  • positional
  • required
  • no help text supplied by click

Yaspin

Yaspin Gif

Click Help Colors

Click Help Colors Example

Colorama

Colorama Example

Click DidYouMean