I'm writing a command-line tool using Python Click package.
For the user input, I want to show/hide the next input option based on the first input.
Here is the sample code:
import click
@click.command()
@click.option('--user/--no-user', prompt='do you want to add user?')
@click.option('--new-user', prompt='add user')
def add_user(user, new_user):
print(user)
print(new_user)
add_user()
I want to show 2nd prompt('--new-user'
) only if the user type yes for the first input('--user/--no-user'
).
Any help how can I do this? Thanks in advance.