def gui_callback(ctx, param, value): if not value or ctx.resilient_parsing: return ctx.command.params = [ p for p in ctx.command.params if p.name not in blacklist ] quick.gui_it(ctx.command) ctx.exit()
@cli.command() @click.argument("multiarg", nargs=-1, required=True) def require(multiarg): print("run:", multiarg) @cli.command() def error(): raise Exception("error") @cli.command() @click.argument("arg", nargs=1, type=click.Choice(['c', 'c++'])) def argument(arg, *argvs): print(arg) # for k, v in argvs.items(): # print(k, v, type(v)) if __name__ == "__main__": # quick.gui_it(example_cmd, run_exit=True) # option_gui() quick.gui_it(cli, run_exit=False, new_thread=False, output="gui", style="qdarkstyle", width=450) # cli()
import quick import click @click.group() @click.option('--debug/--no-debug', default=False) def main(debug): print(debug) @main.command() def sub_func1(): print("running sub_func1") @main.group() def sub_func2(): pass @sub_func2.command() def sub_sub_func1(): print("running sub_sub_func1") if __name__ == "__main__": quick.gui_it(main)
""" Demonstrate mapping variables to dictionary keys """ from quick import gui_it import click @click.command() @click.option('--count', default=1, help='Number of greetings.') @click.option('--name', prompt='Your name', help='The person to greet.') def hello(count, name): """Simple program that greets NAME for a total of COUNT times.""" for x in range(count): click.echo('Hello %s!' % name) if __name__ == '__main__': gui_it(hello, run_exit=False, new_thread=True, output="gui", style="qdarkstyle", width=500)