Skip to content

Commit

Permalink
add zenity prompt driver
Browse files Browse the repository at this point in the history
  • Loading branch information
Andy Clayton committed Oct 4, 2018
1 parent 4cf0045 commit ba6a679
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions prompt/zenity.go
Original file line number Diff line number Diff line change
@@ -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
}

0 comments on commit ba6a679

Please sign in to comment.