diff --git a/README.md b/README.md index 2a01feb..26b3c27 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ gotaskr (Go-Task-Runner) is a generic task runner which is invoked via CLI. The tasks are written in plain Go and can easily be called from the CLI. -This is especially usefull for tasks in the CI. +This is especially useful for tasks in the CI. The tasks can be chained and in the end, there is a statistic about the tasks that were executed and their runtime. @@ -29,7 +29,7 @@ There are some inbuilt helpers for often used things for various DevOps tasks. - Even works in existing go repositories (see [build](build) from this repository as an example) ## Visual Studio Code Extension -gotaskr has a corresponding Visual Studio Code extension that allows easily running or even debugging tasks directly from Visual Studio Code. It also allows to add arguments when running or debugging them. +gotaskr has a corresponding Visual Studio Code extension that allows easily running or even debugging tasks directly from Visual Studio Code. It also allows adding arguments when running or debugging them. Example: diff --git a/execr/execr.go b/execr/execr.go index 5f182ef..f4381db 100644 --- a/execr/execr.go +++ b/execr/execr.go @@ -1,4 +1,4 @@ -// Package execr is a wapper to run exec commands. +// Package execr is a wrapper to run exec commands. package execr import ( diff --git a/goext/goext.go b/goext/goext.go index ea8914e..8567671 100644 --- a/goext/goext.go +++ b/goext/goext.go @@ -13,7 +13,7 @@ func Ternary[T any](cond bool, vtrue, vfalse T) T { return vfalse } -// Printfln allows to use Printf and Println in one call. +// Printfln allows using Printf and Println in one call. func Printfln(format string, a ...any) (n int, err error) { text := fmt.Sprintf(format, a...) return fmt.Println(text) @@ -33,7 +33,7 @@ func Noop() error { } // Pass is a no-op function that can be used to set variables to used. -// Usefull during development but must be removed afterwards! +// Useful during development but must be removed afterwards! func Pass(i ...interface{}) { // No-Op } diff --git a/goext/run.go b/goext/run.go index b68848d..913750d 100644 --- a/goext/run.go +++ b/goext/run.go @@ -13,7 +13,7 @@ type RunOption interface { revert() error } -// Runs a given method with addiitional options. +// Runs a given method with additional options. func RunWithOptions(f func() error, options ...RunOption) (err error) { // Apply the options for _, option := range options { @@ -34,7 +34,7 @@ func RunWithOptions(f func() error, options ...RunOption) (err error) { return } -// Runs a given method with returns one parameter with addiitional options. +// Runs a given method with returns one parameter with additional options. func RunWithOptions1P[P1 any](f func() (P1, error), options ...RunOption) (P1, error) { var p1 P1 return p1, RunWithOptions(func() error { @@ -44,7 +44,7 @@ func RunWithOptions1P[P1 any](f func() (P1, error), options ...RunOption) (P1, e }, options...) } -// Runs a given method with returns two parameters with addiitional options. +// Runs a given method with returns two parameters with additional options. func RunWithOptions2P[P1 any, P2 any](f func() (P1, P2, error), options ...RunOption) (P1, P2, error) { var p1 P1 var p2 P2 @@ -55,7 +55,7 @@ func RunWithOptions2P[P1 any, P2 any](f func() (P1, P2, error), options ...RunOp }, options...) } -// Runs a given method with returns three parameters with addiitional options. +// Runs a given method with returns three parameters with additional options. func RunWithOptions3P[P1 any, P2 any, P3 any](f func() (P1, P2, P3, error), options ...RunOption) (P1, P2, P3, error) { var p1 P1 var p2 P2 diff --git a/goext/slice_extensions.go b/goext/slice_extensions.go index 9ceef51..2a08c17 100644 --- a/goext/slice_extensions.go +++ b/goext/slice_extensions.go @@ -13,7 +13,7 @@ func AppendIf[T any](slice []T, cond bool, values ...T) []T { return slice } -// Appends the given value if the condition is fulfilled. Calculates the value to add only if the condition is fulfulled. +// Appends the given value if the condition is fulfilled. Calculates the value to add only if the condition is fulfilled. func AppendIfFunc[T any](slice []T, cond bool, f func() []T) []T { if cond { values := f() diff --git a/gotaskr.go b/gotaskr.go index c899667..cd206ce 100644 --- a/gotaskr.go +++ b/gotaskr.go @@ -22,7 +22,7 @@ var argumentsMap = argparse.ParseArgs() // Prepare a map for all the task objects var taskMap map[string]*TaskObject = make(map[string]*TaskObject) -// Prepare a list of the task names. Used to print the tasks in order +// Prepare a list of the task names. Used to print the tasks in order. var taskList []string // Prepare an array for the tasks that were run (in run order) @@ -118,7 +118,7 @@ func Execute() int { log.Information() printTaskRuns() - // If the teardown failed but nothing else, still fail with the teardowns error + // If the teardown failed but nothing else, still fail with the teardown error if teardownErr != nil && exitCode == 0 { exitCode = getExitCodeFromError(teardownErr) } @@ -143,7 +143,7 @@ func GetArgumentOrDefault(argName string, defaultValue string) (string, bool) { return defaultValue, false } -// HasArgument returns true if an arument was set and false otherwise, regardless of the value. +// HasArgument returns true if an argument was set and false otherwise, regardless of the value. func HasArgument(argName string) bool { _, exist := GetArgument(argName) return exist @@ -215,7 +215,7 @@ func RunTarget(target string) error { // Run the task teardown method teardownErr := runLifetimeFunc("TaskTeardown", context.TaskTeardownFunc) - // If the teardown failed but nothing else, still fail with the teardowns error + // If the teardown failed but nothing else, still fail with the teardown error if teardownErr != nil && taskErr == nil { return teardownErr } @@ -251,7 +251,7 @@ func runLifetimeFunc(lifetimeStage string, function func() error) error { log.Informationf("--- %s %s", lifetimeStage, strings.Repeat("-", 60-5-len(lifetimeStage))) err := runFuncRecover(function) if err != nil { - log.Informationf("Error occured: %v", err) + log.Informationf("Error occurred: %v", err) return err } return nil @@ -322,10 +322,10 @@ type TaskObject struct { description string // The description of the task. arguments []argument // The arguments of the task. taskFunc func() error // The function of the task. - dependencies []string // A list of dependecy tasks. + dependencies []string // A list of dependency tasks. dependees []string // A list of dependee tasks. followups []string // A list of followup tasks. - continueOnError bool // A flag to incdicate if the run should continue when an error occured. + continueOnError bool // A flag to indicate if the run should continue when an error occurred. deferOnError bool // A flag to indicate if the error should be deferred until the end. didRun bool // A flag to indicate if the task did already run. duration time.Duration // A runtime duration of the task if it ran already. @@ -441,7 +441,7 @@ func (taskObject *TaskObject) Argument(argumentName string, argumentDescription return taskObject } -// AddFollowupTask allows to add one or more tasks that should run after the current finished. +// AddFollowupTask allows adding one or more tasks that should run after the current finished. func AddFollowupTask(taskName ...string) { currentRunningTask.Then(taskName...) } diff --git a/gttools/cypress.go b/gttools/cypress.go index b12b488..ce6ed97 100644 --- a/gttools/cypress.go +++ b/gttools/cypress.go @@ -31,7 +31,7 @@ type CypressRunSettings struct { Browser string // defines the browser to launch like chrome, chromium, edge, electron, firefox. Alternatively a path to an executable. CiBuildId string // the unique id to group tests together. Component bool // flag to define if component tests should run. - Config string // specify the config to use. Defined as key value pairs, comma separated. Can alsop be a stringified json object. + Config string // specify the config to use. Defined as key value pairs, comma separated. Can also be a stringified json object. ConfigFile string // the path to a config file to use. E2e bool // flag to define if end to end tests should run (default). Env map[string]string // environment variables to use. @@ -44,7 +44,7 @@ type CypressRunSettings struct { Port int // override the default port. Project string // the path to a specific project to run. Quiet bool // flag to indicate the quite mode where no output is passed to stdout. - Record bool // flag to indicate if the tests shouldbe recorded or not. + Record bool // flag to indicate if the tests should be recorded or not. Reporter string // define the reporter to use. Can be any of the mocha, cypress or a custom reporter. ReporterOptions string // specify the reporter options to use as key value pairs, comma separated. Can also be a stringified json object. Specs []string // define the spec file(s) to run. @@ -57,7 +57,7 @@ type CypressOpenSettings struct { ToolSettingsBase Browser string // defines the browser to launch like chrome, chromium, edge, electron, firefox. Alternatively a path to an executable. Component bool // flag to define if component tests should run. - Config string // specify the config to use. Defined as key value pairs, comma separated. Can alsop be a stringified json object. + Config string // specify the config to use. Defined as key value pairs, comma separated. Can also be a stringified json object. ConfigFile string // the path to a config file to use. Detached bool // flag to define if Cypress should open in detached mode. E2e bool // flag to define if end to end tests should run (default). @@ -87,7 +87,7 @@ func (settings *CypressRunSettings) AddSpecs(specs ...string) *CypressRunSetting return settings } -// AddTags adds one or more tagst to the Cypress settings. +// AddTags adds one or more tags to the Cypress settings. func (settings *CypressRunSettings) AddTags(tags ...string) *CypressRunSettings { for _, entry := range tags { settings.Tags = goext.AppendIfMissing(settings.Tags, entry) @@ -95,7 +95,7 @@ func (settings *CypressRunSettings) AddTags(tags ...string) *CypressRunSettings return settings } -// CypressRun allows you to run Cypress with a defined binary. Usefull for example when using cy2. +// CypressRun allows you to run Cypress with a defined binary. Useful for example when using cy2. func (tool *CypressTool) CypressRun(cypressBinPath string, settings *CypressRunSettings) error { return cypressExecute(cypressBinPath, settings.buildCliArguments(), settings.ToolSettingsBase) } diff --git a/gttools/devcontainer_cli.go b/gttools/devcontainer_cli.go index c93a76d..85f3f0e 100644 --- a/gttools/devcontainer_cli.go +++ b/gttools/devcontainer_cli.go @@ -170,7 +170,7 @@ type DevContainerCliFeaturesPublishSettings struct { Target string // Name of the OCI registry. Registry string - // Unique indentifier for the collection of features. + // Unique identifier for the collection of features. Namespace string // Log level. LogLevel DevContainerCliLogLevel diff --git a/gttools/flyway.go b/gttools/flyway.go index 3245083..6a86bb9 100644 --- a/gttools/flyway.go +++ b/gttools/flyway.go @@ -60,7 +60,7 @@ type FlywaySettings struct { FailOnMissingLocations *bool // At the start of a migration, Flyway will attempt to take a lock to prevent competing instances executing in parallel. LockRetryCount *int - // Allows you to override Flyway's logging auto-detection and specify one or multiple loggers to use. + // Allows you to override Flyway's logging autodetection and specify one or multiple loggers to use. Loggers []FlywayLogger // Whether to allow mixing transactional and non-transactional statements within the same migration. Mixed *bool @@ -82,7 +82,7 @@ type FlywaySettings struct { WorkingDirectory string //// Schema - // Whether Flyway should attempt to create the schemas specified in the schemas property. + // Whether Flyway should attempt to create the schemas specified in the schemas' property. CreateSchemas *bool // The default schema managed by Flyway. DefaultSchema string @@ -138,7 +138,7 @@ type FlywaySettings struct { OutputType FlywayOutputType //// PostgreSQL - // Whether or not transactional advisory locks should be used with PostgreSQL. + // Whether transactional advisory locks should be used with PostgreSQL. PostgresqlTransactionalLock *bool } diff --git a/gttools/gitlab.go b/gttools/gitlab.go index 9882577..95abac7 100644 --- a/gttools/gitlab.go +++ b/gttools/gitlab.go @@ -13,7 +13,7 @@ func CreateGitLabTool() *GitLabTool { } // GitLabReport defines the data for the quality report for GitLab. -// See https://docs.gitlab.com/ee/ci/testing/code_quality.html#implementing-a-custom-tool for details +// See https://docs.gitlab.com/ee/ci/testing/code_quality.html#implementing-a-custom-tool for details. type GitLabReport struct { Entries []*GitLabCodeQualityEntry } diff --git a/gttools/gttools.go b/gttools/gttools.go index b98c65d..11516f9 100644 --- a/gttools/gttools.go +++ b/gttools/gttools.go @@ -38,7 +38,7 @@ func CreateToolsClient() *ToolsClient { } } -// ToolSettingsBase are common settings usefull for all tools that run executables. +// ToolSettingsBase are common settings useful for all tools that run executables. type ToolSettingsBase struct { WorkingDirectory string // the path to use as working directory when running the tool OutputToConsole bool // flag to define if the output of the tool should be written into the console or not. diff --git a/gttools/nx.go b/gttools/nx.go index 3ab5c29..045c187 100644 --- a/gttools/nx.go +++ b/gttools/nx.go @@ -166,7 +166,7 @@ type NxShowProjectsSettings struct { WithTarget string // Show only projects that have a specific target. } -// ShowProjects returns projects according to the given criterias. +// ShowProjects returns projects according to the given criteria. func (tool *NxTool) ShowProjects(runType NxRunType, settings NxShowProjectsSettings) ([]string, error) { args := []string{"projects"} args = goext.AppendIf(args, settings.Affected, "--affected")