Skip to content

Apply DRY to help flag check #226

@digitalghost-dev

Description

@digitalghost-dev

The manual check for a -h | --help flag is repeated throughout several commands in the project:

if len(os.Args) == 3 && (os.Args[2] == "-h" || os.Args[2] == "--help") {
    flag.Usage()
    return output.String(), nil
}

A reusable function will be created in cmd/utils/:

if utils.CheckHelpFlag(&output, flag.Usage) {
	return output.String(), nil
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    refactorRefactoring existing code.

    Projects

    Status

    Completed

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions