From dac679db48827704899477e04a4fd7f7a7e095a0 Mon Sep 17 00:00:00 2001 From: decentral1se Date: Sun, 5 Sep 2021 00:21:45 +0200 Subject: [PATCH] refactor: punctuation, error handling and package docs --- cli/cli.go | 36 ++++++++++++++++++------------------ cli/version.go | 2 +- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/cli/cli.go b/cli/cli.go index 831078f6..14a73101 100644 --- a/cli/cli.go +++ b/cli/cli.go @@ -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) } } diff --git a/cli/version.go b/cli/version.go index 9dad046e..620d48c2 100644 --- a/cli/version.go +++ b/cli/version.go @@ -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",