Skip to content

Change validation to be DRY #163

@digitalghost-dev

Description

@digitalghost-dev

There are a few instances where the same code logic is being used but with different parameters. Building a function that takes parameters to be customized for each use case will limit repetitiveness.

Repeated function in question:

if len(args) == 3 && args[2] != "-h" && args[2] != "--help" {
	errMsg := styling.ErrorColor.Render("Error!") +
		"\nThe only available options after the\n" + commandName + " command are '-h' or '--help'"
	return fmt.Errorf("%s", styling.ErrorBorder.Render(errMsg))
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    improvementImprovement to an existing feature.

    Projects

    Status

    Completed

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions