feat: Added support for hidden inputs
Hidden Input support
Hiding input in TUI when hide_input=True for an option
@click.option("--foo", hide_input=True)
def exec(foo):
...
Thanks for this!
Does it make sense to have hide_input on options that don't have prompt? My gut feeling is that hide_input is not something that Trogon should handle at all, since it's Click that will accept the input for it.
I think if the option has prompt=True or hidden=True, then we should just not render any widget for it in the form.
Thanks for this!
Does it make sense to have
hide_inputon options that don't haveprompt? My gut feeling is thathide_inputis not something that Trogon should handle at all, since it's Click that will accept the input for it.I think if the option has
prompt=Trueorhidden=True, then we should just not render any widget for it in the form.
Makes sense how about having something that gives info on hide_input flag for a command even if it isn't rendered then?
I think hide_input doesn't make sense, since hide_input is something Click uses when prompt=True to hide the characters the user types. All of the prompt stuff is handled inside Click.
I think
hide_inputdoesn't make sense, sincehide_inputis something Click uses whenprompt=Trueto hide the characters the user types. All of thepromptstuff is handled inside Click.
makes sense I'll change it ⚡
Based on @darrenburns remarks, it would make the most sense that Trogon presented textboxes for these arguments that redacted user input; a textbox for secrets. Does Textual provide such a widget?
Based on click docs, the proper way to handle these options is self-evident, IMO.
https://click.palletsprojects.com/en/8.1.x/api/#click.Option
hide_input(bool) – If this is True then the input on the prompt will be hidden from the user. This is useful for password input.
hidden(bool) – hide this option from help outputs.
Will the hidden option also be tackled in this pr? My organisation can't wait to use trogon, but is blocked by #29
I have a (hopefully temporary) fork of Trogon to make click an optional dependency.
https://github.com/Textualize/trogon/pull/38
In this fork, I just implemented the ability for Trogon to:
- omit hidden parameters and subcommands (when
hidden=True) - show read-only input for required prompts (when
prompt=True, prompt_required=True) - redact sensitive values (when
hide_input=True) <-- This was tricky!
https://asciinema.org/a/0aa5accX2QcN2D8oFwyCYty69
:crossed_fingers: