Skip to content

Commit ecec4bf

Browse files
committed
feat: userinput defaults
1 parent 085fbca commit ecec4bf

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

prompts/input.go

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,18 @@ package prompts
33
import "github.com/manifoldco/promptui"
44

55
type UserInput struct {
6-
Label string
6+
Label string
7+
Default string
78
}
89

910
func (u *UserInput) Run() (string, error) {
1011
prompt := promptui.Prompt{
11-
Label: u.Label,
12+
Label: u.Label,
13+
}
14+
15+
if len(u.Default) > 0 {
16+
prompt.Default = u.Default
1217
}
1318

1419
return prompt.Run()
15-
}
20+
}

0 commit comments

Comments
 (0)