help/README.md
2025-04-21 22:47:04 +03:00

804 B

The "Help" package

This package provides --help flag feature to your cli. It recognize both short and long flags.


Usage

  1. Download the package by go get command:
go get code.foilhatguy.casa/pub/help
  1. Add the package as a tool dependency to your project in tools.go:
// +build tools

package tools

import (
	_ "code.foilhatguy.casa/pub/help"
)
  1. In the main package add a go:generate directive:
//go:generate go run code.foilhatguy.casa/pub/help
  1. Run code generator by go generate command:
go generate ./...

The package will generate a help.go file as a part of the main package. It will contain code for --help flag detection.

  1. Build and run your application with the --help flag.
go run . --help