diff --git a/prompt/zenity.go b/prompt/zenity.go new file mode 100644 index 000000000..efde8b796 --- /dev/null +++ b/prompt/zenity.go @@ -0,0 +1,24 @@ +// +build linux + +package prompt + +import ( + "fmt" + "os/exec" + "strings" +) + +func ZenityPrompt(prompt string) (string, error) { + cmd := exec.Command("/usr/bin/zenity", "--entry", "--title=aws-vault", fmt.Sprintf(`--text=%s`, prompt)) + + out, err := cmd.Output() + if err != nil { + return "", err + } + + return strings.TrimSpace(string(out)), nil +} + +func init() { + Methods["zenity"] = ZenityPrompt +}