refactor: moved a lot of flags & added comments

Comments added to fix the golint errors on exported things need comments
This commit is contained in:
2021-08-02 07:36:35 +01:00
parent 9070806f8d
commit 38d8b51bd5
18 changed files with 330 additions and 248 deletions

View File

@ -12,6 +12,103 @@ import (
"github.com/urfave/cli/v2"
)
// Verbose stores the variable from VerboseFlag
var Verbose bool
// VerboseFlag turns on/off verbose logging down to the INFO level
var VerboseFlag = &cli.BoolFlag{
Name: "verbose",
Aliases: []string{"V"},
Value: false,
Destination: &Verbose,
Usage: "Show INFO messages",
}
// Debug stores the variable from DebugFlag
var Debug bool
// DebugFlag turns on/off verbose logging down to the DEBUG level
var DebugFlag = &cli.BoolFlag{
Name: "debug",
Aliases: []string{"d"},
Value: false,
Destination: &Debug,
Usage: "Show DEBUG messages",
}
// NoPrompt stores the variable from NoPromptFlag
var NoPrompt bool
// NoPromptFlag turns on/off non-interactive mode where no user input is required
var NoPromptFlag = &cli.BoolFlag{
Name: "no-prompt",
Aliases: []string{"n"},
Value: false,
Destination: &NoPrompt,
Usage: "Don't prompt for input and run non-interactively",
}
// Env stores the variable from EnvFlag
var Env string
// EnvFlag takes a path to an env file to load variables from for the abra cli cmd
var EnvFlag = &cli.PathFlag{
Name: "env",
Aliases: []string{"e"},
Value: "",
Destination: &Env,
Usage: "Environment variables to load",
}
// Branch stores the variable from BranchFlag
var Branch string
// BranchFlag takes the name of the git branch to use in app cloning
var BranchFlag = &cli.StringFlag{
Name: "branch",
Aliases: []string{"b"},
Value: "",
Destination: &Branch,
Usage: "Git branch to use while cloning app repos",
}
// SkipUpdate stores the variable from SkipUpdateFlag
var SkipUpdate bool
// SkipUpdateFlag allows users to skip updating recipe definitions
var SkipUpdateFlag = &cli.BoolFlag{
Name: "skip-update",
Aliases: []string{"U"},
Value: false,
Destination: &SkipUpdate,
Usage: "Don't pull latest app definitions",
}
// SkipCheck stores the variable from SkipCheckFlag
var SkipCheck bool
// SkipCheckFlag allows users to skip checking app vars
var SkipCheckFlag = &cli.BoolFlag{
Name: "skip-check",
Aliases: []string{"C"},
Value: false,
Destination: &SkipCheck,
Usage: "Don't verify app variables",
}
// Stack stores the variable from StackFlag
var Stack string
// StackFlag gets the name of the target stack to run commands against
var StackFlag = &cli.StringFlag{
Name: "stack",
Aliases: []string{"s"},
Value: "",
Destination: &Stack,
Usage: "Name of the target stack",
}
// RunApp runs CLI abra app
func RunApp(version, commit string) {
app := &cli.App{
Name: "abra",
@ -32,14 +129,14 @@ func RunApp(version, commit string) {
VersionCommand,
},
Flags: []cli.Flag{
internal.EnvFlag,
internal.StackFlag,
internal.SkipCheckFlag,
internal.SkipUpdateFlag,
internal.VerboseFlag,
internal.BranchFlag,
internal.NoPromptFlag,
internal.DebugFlag,
EnvFlag,
StackFlag,
SkipCheckFlag,
SkipUpdateFlag,
VerboseFlag,
BranchFlag,
NoPromptFlag,
DebugFlag,
internal.ContextFlag,
},
}