-
Notifications
You must be signed in to change notification settings - Fork 245
/
root.go
62 lines (51 loc) · 2.12 KB
/
root.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
// Copyright 2022 Vic Shóstak and Create Go App Contributors. All rights reserved.
// Use of this source code is governed by Apache 2.0 license
// that can be found in the LICENSE file.
package cmd
import (
"github.com/AlecAivazis/survey/v2"
"github.com/spf13/cobra"
"github.com/create-go-app/cli/v3/pkg/cgapp"
"github.com/create-go-app/cli/v3/pkg/registry"
)
var (
backend, frontend, proxy string // define project variables
inventory, playbook map[string]interface{} // define template variables
options, proxyList []string // define options, proxy list
useCustomTemplate bool // define custom templates
askBecomePass bool // install Ansible roles, ask become pass
createAnswers, customCreateAnswers registry.CreateAnswers // define answers variable for `create` command
// Config for survey icons and colors.
// See: https://github.com/mgutz/ansi#style-format
surveyIconsConfig = func(icons *survey.IconSet) {
icons.Question.Format = "cyan"
icons.Question.Text = "[?]"
icons.Help.Format = "blue"
icons.Help.Text = "Help ->"
icons.Error.Format = "yellow"
icons.Error.Text = "Note ->"
}
)
// rootCmd represents the base command when called without any subcommands.
var rootCmd = &cobra.Command{
Use: "cgapp",
Version: registry.CLIVersion,
Short: "A powerful CLI for the Create Go App project",
Long: `
A powerful CLI for the Create Go App project.
Create a new production-ready project with backend (Golang),
frontend (JavaScript, TypeScript) and deploy automation
(Ansible, Docker) by running one CLI command.
-> Focus on writing code and thinking of business logic!
<- The Create Go App CLI will take care of the rest.
A helpful documentation and next steps -> https://create-go.app/`,
}
func init() {
rootCmd.SetOut(cgapp.Stdout)
rootCmd.SetErr(cgapp.Stderr)
}
// Execute adds all child commands to the root command and sets flags appropriately.
// This is called by main.main(). It only needs to happen once to the rootCmd.
func Execute() {
_ = rootCmd.Execute()
}