commands: get HTTP API flags for usage automatically

This commit is contained in:
Frank Schroeder 2017-10-18 00:00:01 +02:00 committed by Frank Schröder
parent cb8faa3559
commit 8f58a603ea
40 changed files with 79 additions and 80 deletions

View File

@ -70,7 +70,7 @@ type cmd struct {
func (c *cmd) init() { func (c *cmd) init() {
c.flags = flag.NewFlagSet("", flag.ContinueOnError) c.flags = flag.NewFlagSet("", flag.ContinueOnError)
config.AddFlags(c.flags, &c.flagArgs) config.AddFlags(c.flags, &c.flagArgs)
c.help = flags.Usage(help, c.flags, nil, nil) c.help = flags.Usage(help, c.flags)
} }
func (c *cmd) Run(args []string) int { func (c *cmd) Run(args []string) int {

View File

@ -20,7 +20,7 @@ func (c *cmd) Synopsis() string {
} }
func (c *cmd) Help() string { func (c *cmd) Help() string {
return flags.Usage(help, nil, nil, nil) return flags.Usage(help, nil)
} }
const synopsis = "Interact with the catalog" const synopsis = "Interact with the catalog"

View File

@ -26,7 +26,7 @@ func (c *cmd) init() {
c.http = &flags.HTTPFlags{} c.http = &flags.HTTPFlags{}
flags.Merge(c.flags, c.http.ClientFlags()) flags.Merge(c.flags, c.http.ClientFlags())
flags.Merge(c.flags, c.http.ServerFlags()) flags.Merge(c.flags, c.http.ServerFlags())
c.help = flags.Usage(help, c.flags, c.http.ClientFlags(), c.http.ServerFlags()) c.help = flags.Usage(help, c.flags)
} }
func (c *cmd) Run(args []string) int { func (c *cmd) Run(args []string) int {

View File

@ -48,7 +48,7 @@ func (c *cmd) init() {
c.http = &flags.HTTPFlags{} c.http = &flags.HTTPFlags{}
flags.Merge(c.flags, c.http.ClientFlags()) flags.Merge(c.flags, c.http.ClientFlags())
flags.Merge(c.flags, c.http.ServerFlags()) flags.Merge(c.flags, c.http.ServerFlags())
c.help = flags.Usage(help, c.flags, c.http.ClientFlags(), c.http.ServerFlags()) c.help = flags.Usage(help, c.flags)
} }
func (c *cmd) Run(args []string) int { func (c *cmd) Run(args []string) int {

View File

@ -46,7 +46,7 @@ func (c *cmd) init() {
c.http = &flags.HTTPFlags{} c.http = &flags.HTTPFlags{}
flags.Merge(c.flags, c.http.ClientFlags()) flags.Merge(c.flags, c.http.ClientFlags())
flags.Merge(c.flags, c.http.ServerFlags()) flags.Merge(c.flags, c.http.ServerFlags())
c.help = flags.Usage(help, c.flags, c.http.ClientFlags(), c.http.ServerFlags()) c.help = flags.Usage(help, c.flags)
} }
func (c *cmd) Run(args []string) int { func (c *cmd) Run(args []string) int {

View File

@ -40,7 +40,7 @@ func (c *cmd) init() {
c.http = &flags.HTTPFlags{} c.http = &flags.HTTPFlags{}
flags.Merge(c.flags, c.http.ClientFlags()) flags.Merge(c.flags, c.http.ClientFlags())
c.help = flags.Usage(help, c.flags, c.http.ClientFlags(), nil) c.help = flags.Usage(help, c.flags)
} }
func (c *cmd) Run(args []string) int { func (c *cmd) Run(args []string) int {

View File

@ -60,7 +60,7 @@ func (c *cmd) init() {
c.http = &flags.HTTPFlags{} c.http = &flags.HTTPFlags{}
flags.Merge(c.flags, c.http.ClientFlags()) flags.Merge(c.flags, c.http.ClientFlags())
flags.Merge(c.flags, c.http.ServerFlags()) flags.Merge(c.flags, c.http.ServerFlags())
c.help = flags.Usage(help, c.flags, c.http.ClientFlags(), c.http.ServerFlags()) c.help = flags.Usage(help, c.flags)
} }
func (c *cmd) Run(args []string) int { func (c *cmd) Run(args []string) int {

View File

@ -10,6 +10,6 @@ func Merge(dst, src *flag.FlagSet) {
return return
} }
src.VisitAll(func(f *flag.Flag) { src.VisitAll(func(f *flag.Flag) {
dst.Var(f.Value, f.Name, f.DefValue) dst.Var(f.Value, f.Name, f.Usage)
}) })
} }

View File

@ -10,21 +10,17 @@ import (
text "github.com/tonnerre/golang-text" text "github.com/tonnerre/golang-text"
) )
func Usage(txt string, cmdFlags, clientFlags, serverFlags *flag.FlagSet) string { func Usage(txt string, flags *flag.FlagSet) string {
u := &Usager{ u := &Usager{
Usage: txt, Usage: txt,
CmdFlags: cmdFlags, Flags: flags,
HTTPClientFlags: clientFlags,
HTTPServerFlags: serverFlags,
} }
return u.String() return u.String()
} }
type Usager struct { type Usager struct {
Usage string Usage string
CmdFlags *flag.FlagSet Flags *flag.FlagSet
HTTPClientFlags *flag.FlagSet
HTTPServerFlags *flag.FlagSet
} }
func (u *Usager) String() string { func (u *Usager) String() string {
@ -33,28 +29,39 @@ func (u *Usager) String() string {
out.WriteString("\n") out.WriteString("\n")
out.WriteString("\n") out.WriteString("\n")
httpFlags := u.HTTPClientFlags if u.Flags != nil {
if httpFlags == nil { f := &HTTPFlags{}
httpFlags = u.HTTPServerFlags clientFlags := f.ClientFlags()
} else { serverFlags := f.ServerFlags()
Merge(httpFlags, u.HTTPServerFlags)
}
if httpFlags != nil { var httpFlags, cmdFlags *flag.FlagSet
printTitle(out, "HTTP API Options") u.Flags.VisitAll(func(f *flag.Flag) {
httpFlags.VisitAll(func(f *flag.Flag) { if contains(clientFlags, f) || contains(serverFlags, f) {
printFlag(out, f) if httpFlags == nil {
}) httpFlags = flag.NewFlagSet("", flag.ContinueOnError)
} }
httpFlags.Var(f.Value, f.Name, f.Usage)
if u.CmdFlags != nil { } else {
printTitle(out, "Command Options") if cmdFlags == nil {
u.CmdFlags.VisitAll(func(f *flag.Flag) { cmdFlags = flag.NewFlagSet("", flag.ContinueOnError)
if flagContains(httpFlags, f) { }
return cmdFlags.Var(f.Value, f.Name, f.Usage)
} }
printFlag(out, f)
}) })
if httpFlags != nil {
printTitle(out, "HTTP API Options")
httpFlags.VisitAll(func(f *flag.Flag) {
printFlag(out, f)
})
}
if cmdFlags != nil {
printTitle(out, "Command Options")
cmdFlags.VisitAll(func(f *flag.Flag) {
printFlag(out, f)
})
}
} }
return strings.TrimRight(out.String(), "\n") return strings.TrimRight(out.String(), "\n")
@ -78,26 +85,18 @@ func printFlag(w io.Writer, f *flag.Flag) {
fmt.Fprintf(w, "%s\n\n", indented) fmt.Fprintf(w, "%s\n\n", indented)
} }
// flagContains returns true if the given flag is contained in the given flag // contains returns true if the given flag is contained in the given flag
// set or false otherwise. // set or false otherwise.
func flagContains(fs *flag.FlagSet, f *flag.Flag) bool { func contains(fs *flag.FlagSet, f *flag.Flag) bool {
if fs == nil { if fs == nil {
return false return false
} }
var skip bool var in bool
fs.VisitAll(func(hf *flag.Flag) { fs.VisitAll(func(hf *flag.Flag) {
if skip { in = in || f.Name == hf.Name
return
}
if f.Name == hf.Name {
skip = true
return
}
}) })
return in
return skip
} }
// maxLineLength is the maximum width of any line. // maxLineLength is the maximum width of any line.

View File

@ -25,7 +25,7 @@ func (c *cmd) init() {
c.flags = flag.NewFlagSet("", flag.ContinueOnError) c.flags = flag.NewFlagSet("", flag.ContinueOnError)
c.http = &flags.HTTPFlags{} c.http = &flags.HTTPFlags{}
flags.Merge(c.flags, c.http.ClientFlags()) flags.Merge(c.flags, c.http.ClientFlags())
c.help = flags.Usage(help, c.flags, c.http.ClientFlags(), nil) c.help = flags.Usage(help, c.flags)
} }
func (c *cmd) Run(args []string) int { func (c *cmd) Run(args []string) int {

View File

@ -26,7 +26,7 @@ func (c *cmd) init() {
c.flags = flag.NewFlagSet("", flag.ContinueOnError) c.flags = flag.NewFlagSet("", flag.ContinueOnError)
c.http = &flags.HTTPFlags{} c.http = &flags.HTTPFlags{}
flags.Merge(c.flags, c.http.ClientFlags()) flags.Merge(c.flags, c.http.ClientFlags())
c.help = flags.Usage(help, c.flags, c.http.ClientFlags(), nil) c.help = flags.Usage(help, c.flags)
} }
func (c *cmd) Run(args []string) int { func (c *cmd) Run(args []string) int {

View File

@ -29,7 +29,7 @@ func (c *cmd) init() {
c.http = &flags.HTTPFlags{} c.http = &flags.HTTPFlags{}
flags.Merge(c.flags, c.http.ClientFlags()) flags.Merge(c.flags, c.http.ClientFlags())
c.help = flags.Usage(help, c.flags, c.http.ClientFlags(), nil) c.help = flags.Usage(help, c.flags)
} }
func (c *cmd) Run(args []string) int { func (c *cmd) Run(args []string) int {

View File

@ -24,7 +24,7 @@ type cmd struct {
func (c *cmd) init() { func (c *cmd) init() {
c.flags = flag.NewFlagSet("", flag.ContinueOnError) c.flags = flag.NewFlagSet("", flag.ContinueOnError)
c.help = flags.Usage(help, c.flags, nil, nil) c.help = flags.Usage(help, c.flags)
} }
func (c *cmd) Run(args []string) int { func (c *cmd) Run(args []string) int {

View File

@ -51,7 +51,7 @@ func (c *cmd) init() {
c.http = &flags.HTTPFlags{} c.http = &flags.HTTPFlags{}
flags.Merge(c.flags, c.http.ClientFlags()) flags.Merge(c.flags, c.http.ClientFlags())
c.help = flags.Usage(help, c.flags, c.http.ClientFlags(), nil) c.help = flags.Usage(help, c.flags)
} }
func (c *cmd) Run(args []string) int { func (c *cmd) Run(args []string) int {

View File

@ -39,7 +39,7 @@ func (c *cmd) init() {
c.http = &flags.HTTPFlags{} c.http = &flags.HTTPFlags{}
flags.Merge(c.flags, c.http.ClientFlags()) flags.Merge(c.flags, c.http.ClientFlags())
flags.Merge(c.flags, c.http.ServerFlags()) flags.Merge(c.flags, c.http.ServerFlags())
c.help = flags.Usage(help, c.flags, c.http.ClientFlags(), c.http.ServerFlags()) c.help = flags.Usage(help, c.flags)
} }
func (c *cmd) Run(args []string) int { func (c *cmd) Run(args []string) int {

View File

@ -29,7 +29,7 @@ func (c *cmd) init() {
c.http = &flags.HTTPFlags{} c.http = &flags.HTTPFlags{}
flags.Merge(c.flags, c.http.ClientFlags()) flags.Merge(c.flags, c.http.ClientFlags())
flags.Merge(c.flags, c.http.ServerFlags()) flags.Merge(c.flags, c.http.ServerFlags())
c.help = flags.Usage(help, c.flags, c.http.ClientFlags(), c.http.ServerFlags()) c.help = flags.Usage(help, c.flags)
} }
func (c *cmd) Run(args []string) int { func (c *cmd) Run(args []string) int {

View File

@ -54,7 +54,7 @@ func (c *cmd) init() {
c.http = &flags.HTTPFlags{} c.http = &flags.HTTPFlags{}
flags.Merge(c.flags, c.http.ClientFlags()) flags.Merge(c.flags, c.http.ClientFlags())
flags.Merge(c.flags, c.http.ServerFlags()) flags.Merge(c.flags, c.http.ServerFlags())
c.help = flags.Usage(help, c.flags, c.http.ClientFlags(), c.http.ServerFlags()) c.help = flags.Usage(help, c.flags)
} }
func (c *cmd) Run(args []string) int { func (c *cmd) Run(args []string) int {

View File

@ -38,7 +38,7 @@ func (c *cmd) init() {
c.http = &flags.HTTPFlags{} c.http = &flags.HTTPFlags{}
flags.Merge(c.flags, c.http.ClientFlags()) flags.Merge(c.flags, c.http.ClientFlags())
flags.Merge(c.flags, c.http.ServerFlags()) flags.Merge(c.flags, c.http.ServerFlags())
c.help = flags.Usage(help, c.flags, c.http.ClientFlags(), c.http.ServerFlags()) c.help = flags.Usage(help, c.flags)
} }
func (c *cmd) Run(args []string) int { func (c *cmd) Run(args []string) int {

View File

@ -20,7 +20,7 @@ func (c *cmd) Synopsis() string {
} }
func (c *cmd) Help() string { func (c *cmd) Help() string {
return flags.Usage(help, nil, nil, nil) return flags.Usage(help, nil)
} }
const synopsis = "Interact with the key-value store" const synopsis = "Interact with the key-value store"

View File

@ -70,7 +70,7 @@ func (c *cmd) init() {
c.http = &flags.HTTPFlags{} c.http = &flags.HTTPFlags{}
flags.Merge(c.flags, c.http.ClientFlags()) flags.Merge(c.flags, c.http.ClientFlags())
flags.Merge(c.flags, c.http.ServerFlags()) flags.Merge(c.flags, c.http.ServerFlags())
c.help = flags.Usage(help, c.flags, c.http.ClientFlags(), c.http.ServerFlags()) c.help = flags.Usage(help, c.flags)
} }
func (c *cmd) Run(args []string) int { func (c *cmd) Run(args []string) int {

View File

@ -25,7 +25,7 @@ func (c *cmd) init() {
c.flags = flag.NewFlagSet("", flag.ContinueOnError) c.flags = flag.NewFlagSet("", flag.ContinueOnError)
c.http = &flags.HTTPFlags{} c.http = &flags.HTTPFlags{}
flags.Merge(c.flags, c.http.ClientFlags()) flags.Merge(c.flags, c.http.ClientFlags())
c.help = flags.Usage(help, c.flags, c.http.ClientFlags(), nil) c.help = flags.Usage(help, c.flags)
} }
func (c *cmd) Run(args []string) int { func (c *cmd) Run(args []string) int {

View File

@ -103,7 +103,7 @@ func (c *cmd) init() {
c.http = &flags.HTTPFlags{} c.http = &flags.HTTPFlags{}
flags.Merge(c.flags, c.http.ClientFlags()) flags.Merge(c.flags, c.http.ClientFlags())
flags.Merge(c.flags, c.http.ServerFlags()) flags.Merge(c.flags, c.http.ServerFlags())
c.help = flags.Usage(help, c.flags, c.http.ClientFlags(), c.http.ServerFlags()) c.help = flags.Usage(help, c.flags)
} }
func (c *cmd) Run(args []string) int { func (c *cmd) Run(args []string) int {

View File

@ -44,7 +44,7 @@ func (c *cmd) init() {
c.flags.StringVar(&c.serviceID, "service", "", c.flags.StringVar(&c.serviceID, "service", "",
"Control maintenance mode for a specific service ID.") "Control maintenance mode for a specific service ID.")
c.help = flags.Usage(help, c.flags, c.http.ClientFlags(), nil) c.help = flags.Usage(help, c.flags)
} }
func (c *cmd) Run(args []string) int { func (c *cmd) Run(args []string) int {

View File

@ -51,7 +51,7 @@ func (c *cmd) init() {
c.flags.StringVar(&c.segment, "segment", consulapi.AllSegments, c.flags.StringVar(&c.segment, "segment", consulapi.AllSegments,
"(Enterprise-only) If provided, output is filtered to only nodes in"+ "(Enterprise-only) If provided, output is filtered to only nodes in"+
"the given segment.") "the given segment.")
c.help = flags.Usage(help, c.flags, c.http.ClientFlags(), nil) c.help = flags.Usage(help, c.flags)
} }
func (c *cmd) Run(args []string) int { func (c *cmd) Run(args []string) int {

View File

@ -40,7 +40,7 @@ func (c *cmd) init() {
c.flags.StringVar(&c.logLevel, "log-level", "INFO", c.flags.StringVar(&c.logLevel, "log-level", "INFO",
"Log level of the agent.") "Log level of the agent.")
c.help = flags.Usage(help, c.flags, c.http.ClientFlags(), nil) c.help = flags.Usage(help, c.flags)
} }
func (c *cmd) Run(args []string) int { func (c *cmd) Run(args []string) int {

View File

@ -27,7 +27,7 @@ func (c *cmd) init() {
c.http = &flags.HTTPFlags{} c.http = &flags.HTTPFlags{}
flags.Merge(c.flags, c.http.ClientFlags()) flags.Merge(c.flags, c.http.ClientFlags())
flags.Merge(c.flags, c.http.ServerFlags()) flags.Merge(c.flags, c.http.ServerFlags())
c.help = flags.Usage(help, c.flags, c.http.ClientFlags(), c.http.ServerFlags()) c.help = flags.Usage(help, c.flags)
} }
func (c *cmd) Run(args []string) int { func (c *cmd) Run(args []string) int {

View File

@ -20,7 +20,7 @@ func (c *cmd) Synopsis() string {
} }
func (c *cmd) Help() string { func (c *cmd) Help() string {
return flags.Usage(help, nil, nil, nil) return flags.Usage(help, nil)
} }
const synopsis = "Provides tools for modifying Autopilot configuration" const synopsis = "Provides tools for modifying Autopilot configuration"

View File

@ -62,7 +62,7 @@ func (c *cmd) init() {
c.http = &flags.HTTPFlags{} c.http = &flags.HTTPFlags{}
flags.Merge(c.flags, c.http.ClientFlags()) flags.Merge(c.flags, c.http.ClientFlags())
flags.Merge(c.flags, c.http.ServerFlags()) flags.Merge(c.flags, c.http.ServerFlags())
c.help = flags.Usage(help, c.flags, c.http.ClientFlags(), c.http.ServerFlags()) c.help = flags.Usage(help, c.flags)
} }
func (c *cmd) Run(args []string) int { func (c *cmd) Run(args []string) int {

View File

@ -20,7 +20,7 @@ func (c *cmd) Synopsis() string {
} }
func (c *cmd) Help() string { func (c *cmd) Help() string {
return flags.Usage(help, nil, nil, nil) return flags.Usage(help, nil)
} }
const synopsis = "Provides cluster-level tools for Consul operators" const synopsis = "Provides cluster-level tools for Consul operators"

View File

@ -28,7 +28,7 @@ func (c *cmd) init() {
c.http = &flags.HTTPFlags{} c.http = &flags.HTTPFlags{}
flags.Merge(c.flags, c.http.ClientFlags()) flags.Merge(c.flags, c.http.ClientFlags())
flags.Merge(c.flags, c.http.ServerFlags()) flags.Merge(c.flags, c.http.ServerFlags())
c.help = flags.Usage(help, c.flags, c.http.ClientFlags(), c.http.ServerFlags()) c.help = flags.Usage(help, c.flags)
} }
func (c *cmd) Run(args []string) int { func (c *cmd) Run(args []string) int {

View File

@ -20,7 +20,7 @@ func (c *cmd) Synopsis() string {
} }
func (c *cmd) Help() string { func (c *cmd) Help() string {
return flags.Usage(help, nil, nil, nil) return flags.Usage(help, nil)
} }
const synopsis = "Provides cluster-level tools for Consul operators" const synopsis = "Provides cluster-level tools for Consul operators"

View File

@ -36,7 +36,7 @@ func (c *cmd) init() {
c.http = &flags.HTTPFlags{} c.http = &flags.HTTPFlags{}
flags.Merge(c.flags, c.http.ClientFlags()) flags.Merge(c.flags, c.http.ClientFlags())
flags.Merge(c.flags, c.http.ServerFlags()) flags.Merge(c.flags, c.http.ServerFlags())
c.help = flags.Usage(help, c.flags, c.http.ClientFlags(), c.http.ServerFlags()) c.help = flags.Usage(help, c.flags)
} }
func (c *cmd) Run(args []string) int { func (c *cmd) Run(args []string) int {

View File

@ -25,7 +25,7 @@ func (c *cmd) init() {
c.flags = flag.NewFlagSet("", flag.ContinueOnError) c.flags = flag.NewFlagSet("", flag.ContinueOnError)
c.http = &flags.HTTPFlags{} c.http = &flags.HTTPFlags{}
flags.Merge(c.flags, c.http.ClientFlags()) flags.Merge(c.flags, c.http.ClientFlags())
c.help = flags.Usage(help, c.flags, c.http.ClientFlags(), nil) c.help = flags.Usage(help, c.flags)
} }
func (c *cmd) Run(args []string) int { func (c *cmd) Run(args []string) int {

View File

@ -34,7 +34,7 @@ func (c *cmd) init() {
c.http = &flags.HTTPFlags{} c.http = &flags.HTTPFlags{}
flags.Merge(c.flags, c.http.ClientFlags()) flags.Merge(c.flags, c.http.ClientFlags())
c.help = flags.Usage(help, c.flags, c.http.ClientFlags(), nil) c.help = flags.Usage(help, c.flags)
} }
func (c *cmd) Run(args []string) int { func (c *cmd) Run(args []string) int {

View File

@ -26,7 +26,7 @@ type cmd struct {
func (c *cmd) init() { func (c *cmd) init() {
c.flags = flag.NewFlagSet("", flag.ContinueOnError) c.flags = flag.NewFlagSet("", flag.ContinueOnError)
c.help = flags.Usage(help, c.flags, nil, nil) c.help = flags.Usage(help, c.flags)
} }
func (c *cmd) Run(args []string) int { func (c *cmd) Run(args []string) int {

View File

@ -27,7 +27,7 @@ func (c *cmd) init() {
c.http = &flags.HTTPFlags{} c.http = &flags.HTTPFlags{}
flags.Merge(c.flags, c.http.ClientFlags()) flags.Merge(c.flags, c.http.ClientFlags())
flags.Merge(c.flags, c.http.ServerFlags()) flags.Merge(c.flags, c.http.ServerFlags())
c.help = flags.Usage(help, c.flags, c.http.ClientFlags(), c.http.ServerFlags()) c.help = flags.Usage(help, c.flags)
} }
func (c *cmd) Run(args []string) int { func (c *cmd) Run(args []string) int {

View File

@ -30,7 +30,7 @@ func (c *cmd) init() {
c.http = &flags.HTTPFlags{} c.http = &flags.HTTPFlags{}
flags.Merge(c.flags, c.http.ClientFlags()) flags.Merge(c.flags, c.http.ClientFlags())
flags.Merge(c.flags, c.http.ServerFlags()) flags.Merge(c.flags, c.http.ServerFlags())
c.help = flags.Usage(help, c.flags, c.http.ClientFlags(), c.http.ServerFlags()) c.help = flags.Usage(help, c.flags)
} }
func (c *cmd) Run(args []string) int { func (c *cmd) Run(args []string) int {

View File

@ -20,7 +20,7 @@ func (c *cmd) Synopsis() string {
} }
func (c *cmd) Help() string { func (c *cmd) Help() string {
return flags.Usage(help, nil, nil, nil) return flags.Usage(help, nil)
} }
const synopsis = "Saves, restores and inspects snapshots of Consul server state" const synopsis = "Saves, restores and inspects snapshots of Consul server state"

View File

@ -26,7 +26,7 @@ func (c *cmd) init() {
c.flags = flag.NewFlagSet("", flag.ContinueOnError) c.flags = flag.NewFlagSet("", flag.ContinueOnError)
c.flags.BoolVar(&c.quiet, "quiet", false, c.flags.BoolVar(&c.quiet, "quiet", false,
"When given, a successful run will produce no output.") "When given, a successful run will produce no output.")
c.help = flags.Usage(help, c.flags, nil, nil) c.help = flags.Usage(help, c.flags)
} }
func (c *cmd) Run(args []string) int { func (c *cmd) Run(args []string) int {

View File

@ -70,7 +70,7 @@ func (c *cmd) init() {
c.http = &flags.HTTPFlags{} c.http = &flags.HTTPFlags{}
flags.Merge(c.flags, c.http.ClientFlags()) flags.Merge(c.flags, c.http.ClientFlags())
flags.Merge(c.flags, c.http.ServerFlags()) flags.Merge(c.flags, c.http.ServerFlags())
c.help = flags.Usage(help, c.flags, c.http.ClientFlags(), c.http.ServerFlags()) c.help = flags.Usage(help, c.flags)
} }
func (c *cmd) Run(args []string) int { func (c *cmd) Run(args []string) int {