NewSpecificRunCommand creates a new run command
(command *latest.CommandConfig)
| 346 | |
| 347 | // NewSpecificRunCommand creates a new run command |
| 348 | func NewSpecificRunCommand(command *latest.CommandConfig) *cobra.Command { |
| 349 | description := command.Description |
| 350 | longDescription := command.Description |
| 351 | if description == "" { |
| 352 | description = "Runs command: " + command.Name |
| 353 | longDescription = description |
| 354 | } |
| 355 | if len(description) > 64 { |
| 356 | if len(description) > 64 { |
| 357 | description = description[:61] + "..." |
| 358 | } |
| 359 | } |
| 360 | |
| 361 | runCmd := &cobra.Command{ |
| 362 | Use: command.Name, |
| 363 | Short: description, |
| 364 | Long: longDescription, |
| 365 | Args: cobra.ArbitraryArgs, |
| 366 | RunE: func(cobraCmd *cobra.Command, originalArgs []string) error { |
| 367 | return cobraCmd.Parent().RunE(cobraCmd, originalArgs) |
| 368 | }, |
| 369 | } |
| 370 | runCmd.DisableFlagParsing = true |
| 371 | return runCmd |
| 372 | } |