in commands/generate.go [83:113]
func (c GenerateCommand) Run(args []string) int {
logrus.Debugf("args: %+v", args)
f := c.flags()
if err := f.Parse(args); err != nil {
logrus.Errorf("Error parsing command-line flags: %+v", err)
return 1
}
logrus.Debugf("flags: %+v", f)
if c.verbose {
log.SetOutput(os.Stdout)
logrus.SetLevel(logrus.DebugLevel)
logrus.Infof("verbose mode enabled")
}
if c.swaggerPath != "" && c.path != "" && c.readmePath != "" {
logrus.Error("only one of 'swagger', 'path' and 'readme' can be specified")
return 1
}
if c.path == "" && c.swaggerPath == "" && c.readmePath == "" {
logrus.Error(c.Help())
return 1
}
if c.readmePath != "" && c.tag == "" {
logrus.Error("tag must be specified when 'readme' is specified")
return 1
}
if c.readmePath == "" && c.tag != "" {
logrus.Errorf("tag can only be specified when 'readme' is specified")
return 1
}
return c.Execute()
}