mirror of https://github.com/markbates/pkger.git
22 lines
368 B
Go
22 lines
368 B
Go
package main
|
|
|
|
import (
|
|
"flag"
|
|
"fmt"
|
|
"io"
|
|
)
|
|
|
|
func Usage(w io.Writer, f *flag.FlagSet) func() {
|
|
return func() {
|
|
pre := "pkger "
|
|
if f.Name() == "pkger" {
|
|
pre = ""
|
|
}
|
|
fmt.Fprintf(w, "%s%s [flags] [args...]\n", pre, f.Name())
|
|
f.VisitAll(func(fl *flag.Flag) {
|
|
fmt.Fprintf(w, "\t-%s\t%s (%q)\n", fl.Name, fl.Usage, fl.DefValue)
|
|
})
|
|
fmt.Fprintln(w)
|
|
}
|
|
}
|