func (lc logsCommand) RunCommand(prog string, args []string, stdin io.Reader, stdout, stderr io.Writer) int {
f := flag.NewFlagSet(prog, flag.ContinueOnError)
pollInterval := f.Duration("poll", time.Second*2, "minimum duration to wait before polling for new data")
- if ok, code := cmd.ParseFlags(f, prog, args, "container-uuid", stderr); !ok {
+ if ok, code := cmd.ParseFlags(f, prog, args, "container-request-uuid", stderr); !ok {
return code
} else if f.NArg() < 1 {
- fmt.Fprintf(stderr, "missing required argument: container-uuid (try -help)\n")
+ fmt.Fprintf(stderr, "missing required argument: container-request-uuid (try -help)\n")
return 2
} else if f.NArg() > 1 {
- fmt.Fprintf(stderr, "encountered extra arguments after container-uuid (try -help)\n")
+ fmt.Fprintf(stderr, "encountered extra arguments after container-request-uuid (try -help)\n")
return 2
}
target := f.Args()[0]
"flag"
"fmt"
"io"
+ "reflect"
)
+// Hack to enable checking whether a given FlagSet's Usage method is
+// the (private) default one.
+var defaultFlagSet = flag.NewFlagSet("none", flag.ContinueOnError)
+
// ParseFlags calls f.Parse(args) and prints appropriate error/help
// messages to stderr.
//
}
return true, 0
case flag.ErrHelp:
- if f, ok := f.(*flag.FlagSet); ok && f.Usage != nil {
+ // Use our own default usage func, not the one
+ // provided by the flag pkg, if the caller hasn't set
+ // one. (We use reflect to determine whether f.Usage
+ // is the private defaultUsage func that
+ // flag.NewFlagSet uses.)
+ if f, ok := f.(*flag.FlagSet); ok && f.Usage != nil && reflect.ValueOf(f.Usage).String() != reflect.ValueOf(defaultFlagSet.Usage).String() {
f.SetOutput(stderr)
f.Usage()
} else {