mirror of
https://github.com/sern-handler/cli
synced 2026-06-15 04:12:33 +00:00
78 lines
1.3 KiB
Go
78 lines
1.3 KiB
Go
package initialize
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/AlecAivazis/survey/v2"
|
|
)
|
|
|
|
var questions = []*survey.Question{
|
|
{
|
|
Name: "name",
|
|
Prompt: &survey.Input{
|
|
Message: "What is your project's name?",
|
|
},
|
|
},
|
|
{
|
|
Name: "language",
|
|
Prompt: &survey.Select{
|
|
Message: "What language do you want to use?",
|
|
Options: []string{"JavaScript", "TypeScript"},
|
|
},
|
|
},
|
|
{
|
|
Name: "main",
|
|
Prompt: &survey.Input{
|
|
Message: "What is your project's main directory?",
|
|
Default: "src",
|
|
},
|
|
},
|
|
{
|
|
Name: "commands",
|
|
Prompt: &survey.Input{
|
|
Message: "What is your project's command directory?",
|
|
Default: "commands",
|
|
},
|
|
},
|
|
{
|
|
Name: "prefix",
|
|
Prompt: &survey.Input{
|
|
Message: "What is your project's command prefix?",
|
|
Default: "!",
|
|
},
|
|
},
|
|
{
|
|
Name: "git",
|
|
Prompt: &survey.Confirm{
|
|
Message: "Do you want to initialize a git repository?",
|
|
},
|
|
},
|
|
{
|
|
Name: "package",
|
|
Prompt: &survey.Select{
|
|
Message: "What package manager do you want to use?",
|
|
Options: []string{"npm", "yarn", "skip"},
|
|
},
|
|
},
|
|
}
|
|
|
|
func Initialize() {
|
|
answers := struct {
|
|
Name string
|
|
Language string
|
|
Main string
|
|
Commands string
|
|
Prefix string
|
|
Git bool
|
|
Package string
|
|
}{}
|
|
|
|
err := survey.Ask(questions, &answers)
|
|
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
|
|
fmt.Println(answers)
|
|
}
|