MCPcopy Create free account
hub / github.com/SpectoLabs/hoverfly / askForInput

Function askForInput

hoverctl/cmd/utils.go:51–73  ·  view source on GitHub ↗
(value string, sensitive bool)

Source from the content-addressed store, hash-verified

49}
50
51func askForInput(value string, sensitive bool) string {
52 if force {
53 return ""
54 }
55
56 reader := bufio.NewReader(os.Stdin)
57
58 for {
59 fmt.Printf("%s: ", value)
60 if sensitive {
61 responseBytes, err := term.ReadPassword(int(os.Stdin.Fd()))
62 handleIfError(err)
63 fmt.Println("")
64
65 return strings.TrimSpace(string(responseBytes))
66 } else {
67 response, err := reader.ReadString('\n')
68 handleIfError(err)
69
70 return strings.TrimSpace(response)
71 }
72 }
73}
74
75func drawTable(data [][]string, header bool) {
76 table := tablewriter.NewWriter(os.Stdout)

Callers 3

start.goFile · 0.85
askForConfirmationFunction · 0.85
login.goFile · 0.85

Calls 1

handleIfErrorFunction · 0.85

Tested by

no test coverage detected