-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
placeholder.go
48 lines (40 loc) · 981 Bytes
/
placeholder.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
package main
import (
"fmt"
"github.com/AlecAivazis/survey/v2"
"github.com/urfave/cli/v2"
)
func PlaceholderCommand(ctx *cli.Context) error {
answers := struct {
Placeholder string
Count int
}{}
survey.Ask([]*survey.Question{
{
Name: "placeholder",
Prompt: &survey.Input{
Message: "What do you want placeholder for?",
},
Validate: survey.Required,
},
{
Name: "count",
Prompt: &survey.Input{
Message: "Number of records to generate?",
},
Validate: survey.ComposeValidators(survey.Required, SurveyNumberValidator),
Transform: SurveyNumberTransform,
},
}, &answers)
s := CreateSpinner()
s.Suffix = " Generating mock placeholder data 🪄\n"
s.Start()
result, err := AskAI(fmt.Sprintf(`Generate %d placeholder data for %s`, answers.Count, answers.Placeholder))
s.Stop()
if err != nil {
return err
}
fmt.Println(boldGreen("\n✅ Mock data generated successfully 🐙\n"))
fmt.Println(result)
return nil
}