-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Closed
Labels
f:promptfeature: prompt for inputfeature: prompt for input
Description
I have a script with subcommands that both require a username/password. I abstracted this to the parent. Here's a short example demonstrating the issue:
import click
@click.group()
@click.option('--username', default='admin', prompt=True)
@click.password_option()
def cli(username, password):
"""This is my parent description"""
pass
@cli.command()
@click.option('--reference', help="I should be able to see this without entering a username and password.")
def subcommand(reference):
"""This is my subcommand"""
passIf you access the main help:
my_prog --helpIt displays the help page without any prompting for username or password, as expected. However, if you try to access the help page for the subcommand:
my_prog subcommand --helpIt prompts for username and password before displaying the help page of the subcommand. This makes sense, but it still isn't expected behavior by the end user. As my sample program says, I should be able to see help without entering a username and password.
What's the correct way to model my desired behavior? Do I have to move and duplicate the username and password prompt options into each of my sub commands?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
f:promptfeature: prompt for inputfeature: prompt for input