MCPcopy Create free account
hub / github.com/cloudbase/garm / PromptString

Function PromptString

cmd/garm-cli/common/common.go:60–77  ·  view source on GitHub ↗
(label string, a ...interface{})

Source from the content-addressed store, hash-verified

58}
59
60func PromptString(label string, a ...interface{}) (string, error) {
61 validate := func(input string) error {
62 if len(input) == 0 {
63 return errors.New("empty input not allowed")
64 }
65 return nil
66 }
67
68 prompt := promptui.Prompt{
69 Label: fmt.Sprintf(label, a...),
70 Validate: validate,
71 }
72 result, err := prompt.Run()
73 if err != nil {
74 return "", err
75 }
76 return result, nil
77}
78
79func PrintWebsocketMessage(_ int, msg []byte) error {
80 fmt.Println(util.SanitizeLogEntry(string(msg)))

Callers 2

promptUnsetInitVariablesFunction · 0.92

Calls 1

RunMethod · 0.45

Tested by

no test coverage detected