Oct-09-2016, 07:54 AM
Here is the code,
value, args = param.handle_parse_result(ctx, opts, args)
What does it mean? Thanks.
#test.py import click def print_version(ctx, value): if not value or ctx.resilient_parsing: return click.echo('Version 1.0') ctx.exit() @click.command() @click.option('--version', is_flag=True, callback=print_version, expose_value=False, is_eager=True) def main(): click.echo('Hello world') if __name__ == '__main__': main()When I run the code with test.py --version 1.0,I got a Warning: Invoked legacy parameter callback "<function print_version at 0x0000000002BE2A58>". The new signature for such callbacks starting with click 2.0 is (ctx, param, value).
value, args = param.handle_parse_result(ctx, opts, args)
What does it mean? Thanks.