how to debug python click cli application?

This is not well documented, but you can call your command functions directly, and thus can run the code in a debugger:

Sample Code:

import click

@click.command()
@click.option('--my_arg', default=1, help='a number')
def my_command(my_arg):
    click.echo("my_arg='%d'" % my_arg)

if __name__ == '__main__':
    my_command(['--my_arg', '3'])

Result:

my_arg='3'

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)