Optional argument in command with click
问题 I am trying to accomplish something not very standard for CLI parsing with Click and it only works partially: main CLI has multiple sub-commands (in sample below 'show' and 'check') both those commands might have optional argument, but the argument is preceding them not following I decided to handle that argument in the group "above" it and pass the value in the context Sample: import click @click.group() @click.argument('hostname', required=False) @click.pass_context def cli(ctx, hostname