UsageExamples builds a section template that generates a help text showing a valid invocation of the CLI tool.
(data []*CommandData)
| 268 | // UsageExamples builds a section template that generates a help text showing |
| 269 | // a valid invocation of the CLI tool. |
| 270 | func UsageExamples(data []*CommandData) *codegen.SectionTemplate { |
| 271 | var examples []string |
| 272 | for i, cmd := range data { |
| 273 | if i < 5 { |
| 274 | examples = append(examples, cmd.Example) |
| 275 | } |
| 276 | } |
| 277 | |
| 278 | return &codegen.SectionTemplate{Source: cliTemplates.Read(usageExamplesT), Data: examples} |
| 279 | } |
| 280 | |
| 281 | // FlagsCode returns a string containing the code that parses the command-line |
| 282 | // flags to infer the command (service), sub-command (method), and the |
no test coverage detected