click-contrib / click-repl

Subcommand REPL for click apps
MIT License
215 stars 41 forks source link

No completion of type=click.Choice for Options #66

Closed mirhmousavi closed 1 year ago

mirhmousavi commented 4 years ago

Hi thanks for this great library. I'm wondering that does completion for type=click.Choice for options available? this is my code

import click
from click_repl import repl

@click.group(invoke_without_command=True,)
@click.pass_context
def main(ctx):
    if not ctx.invoked_subcommand:
        repl(click.get_current_context())

@main.group()
def user():
    pass

@user.command()
@click.option('-type', type=click.Choice(['1', '2']))
def search(name):
    pass

if __name__ == '__main__':
    main()

I won't get completion for -type

untitaker commented 4 years ago

It does not complete any parameter values, but patches welcome!

On October 28, 2019 1:22:36 PM GMT+01:00, Mir Hossein Mousavi notifications@github.com wrote:

Hi thanks for this great library. I'm wondering that does completion for type=click.Choice for options available? this is my code

import click

@click.group(invoke_without_command=True,)
@click.pass_context
def main(ctx):
   if not ctx.invoked_subcommand:
       repl(click.get_current_context())

@main.group()
def user():
   pass

@user.command()
@click.option('-type', type=click.Choice(['1', '2']))
def search(name):
   pass

if __name__ == '__main__':
   main()

I won't get completion for -type

-- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/click-contrib/click-repl/issues/66

mirhmousavi commented 4 years ago

I'll examine the code to figure out that can I implement it or not thanks

mirhmousavi commented 4 years ago

I made some changes to the library to choice values be shown in the command help text https://github.com/click-contrib/click-repl/pull/67