generationTargets sets cfg options based on the generation targets.
(cfg *codegen.Configuration, targets []string)
| 511 | |
| 512 | // generationTargets sets cfg options based on the generation targets. |
| 513 | func generationTargets(cfg *codegen.Configuration, targets []string) error { |
| 514 | opts := codegen.GenerateOptions{} // Blank to start with. |
| 515 | for _, opt := range targets { |
| 516 | switch opt { |
| 517 | case "iris", "iris-server": |
| 518 | opts.IrisServer = true |
| 519 | case "chi-server", "chi": |
| 520 | opts.ChiServer = true |
| 521 | case "fiber-server", "fiber": |
| 522 | opts.FiberServer = true |
| 523 | case "server", "echo-server", "echo": |
| 524 | opts.EchoServer = true |
| 525 | case "echo5", "echo5-server": |
| 526 | opts.Echo5Server = true |
| 527 | case "gin", "gin-server": |
| 528 | opts.GinServer = true |
| 529 | case "gorilla", "gorilla-server": |
| 530 | opts.GorillaServer = true |
| 531 | case "std-http", "std-http-server": |
| 532 | opts.StdHTTPServer = true |
| 533 | case "strict-server": |
| 534 | opts.Strict = true |
| 535 | case "client": |
| 536 | opts.Client = true |
| 537 | case "types", "models": |
| 538 | opts.Models = true |
| 539 | case "spec", "embedded-spec": |
| 540 | opts.EmbeddedSpec = true |
| 541 | case "skip-fmt": |
| 542 | cfg.OutputOptions.SkipFmt = true |
| 543 | case "skip-prune": |
| 544 | cfg.OutputOptions.SkipPrune = true |
| 545 | default: |
| 546 | return fmt.Errorf("unknown generate option %q", opt) |
| 547 | } |
| 548 | } |
| 549 | cfg.Generate = opts |
| 550 | |
| 551 | return nil |
| 552 | } |
| 553 | |
| 554 | func newConfigFromOldConfig(c oldConfiguration) (configuration, error) { |
| 555 | // Take flags into account. |
no outgoing calls
no test coverage detected