github.com/josephspurrier/go-swagger@v0.2.1-0.20221129144919-1f672a142a00/cmd/swagger/commands/generate/cli.go (about) 1 package generate 2 3 import "github.com/go-swagger/go-swagger/generator" 4 5 type Cli struct { 6 // generate a cli includes all client code 7 Client 8 // cmd/<cli-app-name>/main.go will be generated. This ensures that go install will compile the app with desired name. 9 CliAppName string `long:"cli-app-name" description:"the app name for the cli executable. useful for go install." default:"cli"` 10 } 11 12 func (c Cli) apply(opts *generator.GenOpts) { 13 c.Client.apply(opts) 14 opts.IncludeCLi = true 15 opts.CliPackage = "cli" // hardcoded for now, can be exposed via cmd opt later 16 opts.CliAppName = c.CliAppName 17 } 18 19 func (c *Cli) generate(opts *generator.GenOpts) error { 20 return c.Client.generate(opts) 21 } 22 23 // Execute runs this command 24 func (c *Cli) Execute(args []string) error { 25 return createSwagger(c) 26 }