The Flag package to parse Go arguments passed to entry point of the application (main)
To change the usage output, you need to overwrite the Usage variable.
Example to add an header and a footer
flag.Usage = func() {
fmt.Fprintln(os.Stderr, "An header")
fmt.Fprintf(os.Stderr, "Usage of %s:\n", os.Args[0])
flag.PrintDefaults()
fmt.Fprintln(os.Stderr, "A footer")
}
The non-flag arguments are available from flag.Args()
fmt.Println("tail:", flag.Args())