(env *execenv.Env)
| 16 | } |
| 17 | |
| 18 | func newBugNewCommand(env *execenv.Env) *cobra.Command { |
| 19 | options := bugNewOptions{} |
| 20 | |
| 21 | cmd := &cobra.Command{ |
| 22 | Use: "new", |
| 23 | Short: "Create a new bug", |
| 24 | PreRunE: execenv.LoadBackendEnsureUser(env), |
| 25 | RunE: execenv.CloseBackend(env, func(cmd *cobra.Command, args []string) error { |
| 26 | return runBugNew(env, options) |
| 27 | }), |
| 28 | } |
| 29 | |
| 30 | flags := cmd.Flags() |
| 31 | flags.SortFlags = false |
| 32 | |
| 33 | flags.StringVarP(&options.title, "title", "t", "", |
| 34 | "Provide a title to describe the issue") |
| 35 | flags.StringVarP(&options.message, "message", "m", "", |
| 36 | "Provide a message to describe the issue") |
| 37 | flags.StringVarP(&options.messageFile, "file", "F", "", |
| 38 | "Take the message from the given file. Use - to read the message from the standard input") |
| 39 | flags.BoolVar(&options.nonInteractive, "non-interactive", false, "Do not ask for user input") |
| 40 | |
| 41 | return cmd |
| 42 | } |
| 43 | |
| 44 | func runBugNew(env *execenv.Env, opts bugNewOptions) error { |
| 45 | var err error |
no test coverage detected