You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
47 lines
1.1 KiB
Go
47 lines
1.1 KiB
Go
3 years ago
|
package env
|
||
|
|
||
|
import "github.com/spf13/cobra"
|
||
|
|
||
|
var (
|
||
|
sliceVarWriteValue []string
|
||
|
boolVarForce bool
|
||
|
boolVarVerbose bool
|
||
|
boolVarInstall bool
|
||
|
|
||
|
// Cmd describes a env command.
|
||
|
Cmd = &cobra.Command{
|
||
|
Use: "env",
|
||
|
Short: "Check or edit goctl environment",
|
||
|
RunE: write,
|
||
|
}
|
||
|
installCmd = &cobra.Command{
|
||
|
Use: "install",
|
||
|
Short: "Goctl env installation",
|
||
|
RunE: install,
|
||
|
}
|
||
|
checkCmd = &cobra.Command{
|
||
|
Use: "check",
|
||
|
Short: "Detect goctl env and dependency tools",
|
||
|
RunE: check,
|
||
|
}
|
||
|
)
|
||
|
|
||
|
func init() {
|
||
|
// The root command flags
|
||
|
Cmd.Flags().StringSliceVarP(&sliceVarWriteValue,
|
||
|
"write", "w", nil, "Edit goctl environment")
|
||
|
Cmd.PersistentFlags().BoolVarP(&boolVarForce,
|
||
|
"force", "f", false,
|
||
|
"Silent installation of non-existent dependencies")
|
||
|
Cmd.PersistentFlags().BoolVarP(&boolVarVerbose,
|
||
|
"verbose", "v", false, "Enable log output")
|
||
|
|
||
|
// The sub-command flags
|
||
|
checkCmd.Flags().BoolVarP(&boolVarInstall, "install", "i",
|
||
|
false, "Install dependencies if not found")
|
||
|
|
||
|
// Add sub-command
|
||
|
Cmd.AddCommand(installCmd)
|
||
|
Cmd.AddCommand(checkCmd)
|
||
|
}
|