click-contrib / click-default-group

Extends click.Group to invoke a command without explicit subcommand name.
BSD 3-Clause "New" or "Revised" License
72 stars 17 forks source link

click-default-group breaks click-repl #4

Open oberstet opened 7 years ago

oberstet commented 7 years ago

From https://github.com/pallets/click/issues/430#issuecomment-282015177:

Using

@click.group(cls=DefaultGroup, default='shell', default_if_no_args=True)

breaks the auto-completion integration with prompt-toolkit from click-repl.

Why is it preferred versus the following anyway (which works, and does not break click-repl?

@click.group(invoke_without_command=True)
@click.option(
    '--profile',
    help='profile to use',
    default=u'default'
)
@click.pass_context
def cli(ctx, profile):
    ctx.obj = Config(_app, profile)
    if ctx.invoked_subcommand is None:
        ctx.invoke(cmd_shell)
jorhett commented 2 years ago

Why is it preferred versus the following

I tried that, and couldn't get all the arguments being passed to the subcommand to work.