mirror of
https://github.com/kovidgoyal/kitty
synced 2026-06-09 23:54:20 +02:00
Implement reading of password
This commit is contained in:
@@ -14,12 +14,20 @@ var _ = fmt.Print
|
||||
func main(_ *cli.Command, o *Options, args []string) (rc int, err error) {
|
||||
output := tui.KittenOutputSerializer()
|
||||
var result any
|
||||
if len(o.Prompt) > 2 && o.Prompt[0] == o.Prompt[len(o.Prompt)-1] && (o.Prompt[0] == '"' || o.Prompt[0] == '\'') {
|
||||
o.Prompt = o.Prompt[1 : len(o.Prompt)-1]
|
||||
}
|
||||
switch o.Type {
|
||||
case "yesno", "choices":
|
||||
result, err = choices(o, args)
|
||||
if err != nil {
|
||||
return rc, err
|
||||
}
|
||||
case "password":
|
||||
result, err = tui.ReadPassword(o.Prompt, true)
|
||||
if err != nil {
|
||||
return rc, err
|
||||
}
|
||||
default:
|
||||
return 1, fmt.Errorf("Unknown type: %s", o.Type)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user