Skip to content

Option that is not required and prompts if specified without an arg #736

@johnksterling

Description

@johnksterling

Hi -

I am working on a ticket for mycli - the gist is that the team wants the '-p' flag to behave like th e mysql client - i.e. prompt if you don't pass an arg, but it is not required so do NOT prompt if the -p is not included. Today if I use standard click->prompt then scenario 2 gives an error. Below is the desired behavior:

  1. $> ./hello
    HELLO WORLD
  2. $> ./hello -p
    Please enter your password:
  3. $> ./hello -p s3cr3t
    HELLO WORLD

It appears looking at the code there is no way to do this, but it seems desirable - before working on a PR I wanted to validate that it can't be done and get input on the usefulness of the feature.

Thanks for your guidance
John

Metadata

Metadata

Assignees

No one assigned

    Labels

    f:promptfeature: prompt for input

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions