Finish porting of ask kitten to Go

This commit is contained in:
Kovid Goyal
2023-03-07 17:06:00 +05:30
parent 018bf46ddb
commit f157882856
3 changed files with 104 additions and 468 deletions

View File

@@ -34,7 +34,7 @@ func main(_ *cli.Command, o *Options, args []string) (rc int, err error) {
}
case "password":
show_message(o.Message)
pw, err := tui.ReadPassword(o.Prompt, true)
pw, err := tui.ReadPassword(o.Prompt, false)
if err != nil {
if errors.Is(err, tui.Canceled) {
pw = ""
@@ -43,6 +43,12 @@ func main(_ *cli.Command, o *Options, args []string) (rc int, err error) {
}
}
result = map[string]any{"items": args, "response": pw}
case "line":
show_message(o.Message)
result, err = get_line(o, args)
if err != nil {
return 1, err
}
default:
return 1, fmt.Errorf("Unknown type: %s", o.Type)
}