// noVCSVersionOverride allows overriding the version of the application for cases where no Version Control System (VCS) is available when building, for instance when using a Nix derivation.
// See documentation for how to use it in examples/no-vcs-version-override/README.md
varnoVCSVersionOverridestring
funcmain() {
flag.StringVar(&flagOutputFile, "o", "", "Where to output generated code, stdout is default.")
flag.BoolVar(&flagOldConfigStyle, "old-config-style", false, "Whether to use the older style config file format.")
flag.BoolVar(&flagOutputConfig, "output-config", false, "When true, outputs a configuration file for oapi-codegen using current settings.")
flag.StringVar(&flagConfigFile, "config", "", "A YAML config file that controls oapi-codegen behavior.")
flag.BoolVar(&flagPrintVersion, "version", false, "When specified, print version and exit.")
flag.StringVar(&flagPackageName, "package", "", "The package name for generated code.")
flag.BoolVar(&flagPrintUsage, "help", false, "Show this help and exit.")
flag.BoolVar(&flagPrintUsage, "h", false, "Same as -help.")
// All flags below are deprecated, and will be removed in a future release. Please do not
`Comma-separated list of code to generate; valid options: "types", "client", "chi-server", "server", "gin", "gorilla", "spec", "skip-fmt", "skip-prune", "fiber", "fiber-v3", "iris", "std-http".`)
flag.StringVar(&flagIncludeTags, "include-tags", "", "Only include operations with the given tags. Comma-separated list of tags.")
flag.StringVar(&flagExcludeTags, "exclude-tags", "", "Exclude operations that are tagged with the given tags. Comma-separated list of tags.")
flag.StringVar(&flagIncludeOperationIDs, "include-operation-ids", "", "Only include operations with the given operation-ids. Comma-separated list of operation-ids.")
flag.StringVar(&flagExcludeOperationIDs, "exclude-operation-ids", "", "Exclude operations with the given operation-ids. Comma-separated list of operation-ids.")
flag.StringVar(&flagTemplatesDir, "templates", "", "Path to directory containing user templates.")
flag.StringVar(&flagImportMapping, "import-mapping", "", "A dict from the external reference to golang package path.")
flag.StringVar(&flagExcludeSchemas, "exclude-schemas", "", "A comma separated list of schemas which must be excluded from generation.")
flag.StringVar(&flagResponseTypeSuffix, "response-type-suffix", "", "The suffix used for responses types.")
flag.BoolVar(&flagAliasTypes, "alias-types", false, "Alias type declarations if possible.")
// If one of the two files parses, but the other fails, we know the
// answer.
ifoldErr!=nil&&newErr==nil {
f:=false
oldConfigStyle=&f
} elseifoldErr==nil&&newErr!=nil {
t:=true
oldConfigStyle=&t
} elseifoldErr!=nil&&newErr!=nil {
errExit("error parsing configuration style as old version or new version\n\nerror when parsing using old config version:\n%v\n\nerror when parsing using new config version:\n%v\n", oldErr, newErr)
}
// Else we fall through, and we still don't know, so we need to infer it from flags.
}
ifoldConfigStyle==nil {
// If any deprecated flag is present, and config file structure is unknown,
// the presence of the deprecated flag means we must be using the old
// config style. It should work correctly if we go down the old path,
// even if we have a simple config file readable as both types.