refactor: punctuation, error handling and package docs

This commit is contained in:
decentral1se 2021-09-05 00:21:45 +02:00
parent 254a4d6d43
commit dac679db48
No known key found for this signature in database
GPG Key ID: 5E2EF5A63E3718CC
2 changed files with 19 additions and 19 deletions

View File

@ -1,3 +1,4 @@
// Package cli provides the interface for the command-line.
package cli
import (
@ -12,10 +13,10 @@ import (
"github.com/urfave/cli/v2"
)
// Verbose stores the variable from VerboseFlag
// Verbose stores the variable from VerboseFlag.
var Verbose bool
// VerboseFlag turns on/off verbose logging down to the INFO level
// VerboseFlag turns on/off verbose logging down to the INFO level.
var VerboseFlag = &cli.BoolFlag{
Name: "verbose",
Aliases: []string{"V"},
@ -24,10 +25,10 @@ var VerboseFlag = &cli.BoolFlag{
Usage: "Show INFO messages",
}
// Debug stores the variable from DebugFlag
// Debug stores the variable from DebugFlag.
var Debug bool
// DebugFlag turns on/off verbose logging down to the DEBUG level
// DebugFlag turns on/off verbose logging down to the DEBUG level.
var DebugFlag = &cli.BoolFlag{
Name: "debug",
Aliases: []string{"d"},
@ -36,10 +37,10 @@ var DebugFlag = &cli.BoolFlag{
Usage: "Show DEBUG messages",
}
// NoPrompt stores the variable from NoPromptFlag
// NoPrompt stores the variable from NoPromptFlag.
var NoPrompt bool
// NoPromptFlag turns on/off non-interactive mode where no user input is required
// NoPromptFlag turns on/off non-interactive mode where no user input is required.
var NoPromptFlag = &cli.BoolFlag{
Name: "no-prompt",
Aliases: []string{"n"},
@ -48,10 +49,10 @@ var NoPromptFlag = &cli.BoolFlag{
Usage: "Don't prompt for input and run non-interactively",
}
// Env stores the variable from EnvFlag
// 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
// 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"},
@ -60,10 +61,10 @@ var EnvFlag = &cli.PathFlag{
Usage: "Environment variables to load",
}
// Branch stores the variable from BranchFlag
// Branch stores the variable from BranchFlag.
var Branch string
// BranchFlag takes the name of the git branch to use in app cloning
// BranchFlag takes the name of the git branch to use in app cloning.
var BranchFlag = &cli.StringFlag{
Name: "branch",
Aliases: []string{"b"},
@ -75,7 +76,7 @@ var BranchFlag = &cli.StringFlag{
// SkipUpdate stores the variable from SkipUpdateFlag
var SkipUpdate bool
// SkipUpdateFlag allows users to skip updating recipe definitions
// SkipUpdateFlag allows users to skip updating recipe definitions.
var SkipUpdateFlag = &cli.BoolFlag{
Name: "skip-update",
Aliases: []string{"U"},
@ -84,10 +85,10 @@ var SkipUpdateFlag = &cli.BoolFlag{
Usage: "Don't pull latest app definitions",
}
// SkipCheck stores the variable from SkipCheckFlag
// SkipCheck stores the variable from SkipCheckFlag.
var SkipCheck bool
// SkipCheckFlag allows users to skip checking app vars
// SkipCheckFlag allows users to skip checking app vars.
var SkipCheckFlag = &cli.BoolFlag{
Name: "skip-check",
Aliases: []string{"C"},
@ -96,10 +97,10 @@ var SkipCheckFlag = &cli.BoolFlag{
Usage: "Don't verify app variables",
}
// Stack stores the variable from StackFlag
// Stack stores the variable from StackFlag.
var Stack string
// StackFlag gets the name of the target stack to run commands against
// StackFlag gets the name of the target stack to run commands against.
var StackFlag = &cli.StringFlag{
Name: "stack",
Aliases: []string{"s"},
@ -108,7 +109,7 @@ var StackFlag = &cli.StringFlag{
Usage: "Name of the target stack",
}
// RunApp runs CLI abra app
// RunApp runs CLI abra app.
func RunApp(version, commit string) {
app := &cli.App{
Name: "abra",
@ -141,8 +142,7 @@ func RunApp(version, commit string) {
},
}
err := app.Run(os.Args)
if err != nil {
if err := app.Run(os.Args); err != nil {
logrus.Fatal(err)
}
}

View File

@ -4,7 +4,7 @@ import (
"github.com/urfave/cli/v2"
)
// VersionCommand prints the version of abra
// VersionCommand prints the version of abra.
var VersionCommand = &cli.Command{
Name: "version",
Usage: "Print the version",