You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I have an option with Choice, the choices are not displayed. It displays true/false listing.
Here after typing -a/--add it should show
> print-opt -a
foo
bar
instead it displays:
> print-opt -a
true 1/true/t/yes/y/on
false 0/false/f/no/n/off
Interestingly, if I rearrange the parameters, and put the option with Choice at the end, it will display the list of available option correctly.
The following code reproduces the issue.
importclickimportclick_replA_LIST= ["foo", "bar"]
@click.group()@click.pass_contextdefroot_command(ctx):
pass@root_command.command()@click.pass_contextdefshell(
ctx: click.core.Context,
) ->None:
"""Starts a interactive terminal"""click_repl.repl(ctx)
# Following code will not display the list of available options but, if I rearrange the code like this# @click.option("-v", "--view", is_flag=True, default=False, help="View search sources")# @click.option("-a", "--add", type=click.Choice(A_LIST, case_sensitive=False))# It will display the list of available option@root_command.command()@click.option("-a", "--add", type=click.Choice(A_LIST, case_sensitive=False))@click.option("-v", "--view", is_flag=True, default=False, help="View search sources")@click.pass_contextdefprint_opt(ctx, add, view):
print(add)
if__name__=='__main__':
root_command()
The text was updated successfully, but these errors were encountered:
When I have an option with Choice, the choices are not displayed. It displays true/false listing.
Here after typing
-a/--add
it should showinstead it displays:
Interestingly, if I rearrange the parameters, and put the option with Choice at the end, it will display the list of available option correctly.
The following code reproduces the issue.
The text was updated successfully, but these errors were encountered: