(env *execenv.Env)
| 20 | } |
| 21 | |
| 22 | func newBugShowCommand(env *execenv.Env) *cobra.Command { |
| 23 | options := bugShowOptions{} |
| 24 | |
| 25 | cmd := &cobra.Command{ |
| 26 | Use: "show [BUG_ID]", |
| 27 | Short: "Display the details of a bug", |
| 28 | PreRunE: execenv.LoadBackend(env), |
| 29 | RunE: execenv.CloseBackend(env, func(cmd *cobra.Command, args []string) error { |
| 30 | return runBugShow(env, options, args) |
| 31 | }), |
| 32 | ValidArgsFunction: BugCompletion(env), |
| 33 | } |
| 34 | |
| 35 | flags := cmd.Flags() |
| 36 | flags.SortFlags = false |
| 37 | |
| 38 | fields := []string{"author", "authorEmail", "createTime", "lastEdit", "humanId", |
| 39 | "id", "labels", "shortId", "status", "title", "actors", "participants"} |
| 40 | flags.StringVarP(&options.fields, "field", "", "", |
| 41 | "Select field to display. Valid values are ["+strings.Join(fields, ",")+"]") |
| 42 | cmd.RegisterFlagCompletionFunc("by", completion.From(fields)) |
| 43 | flags.StringVarP(&options.format, "format", "f", "default", |
| 44 | "Select the output formatting style. Valid values are [default,json,org-mode]") |
| 45 | |
| 46 | return cmd |
| 47 | } |
| 48 | |
| 49 | func runBugShow(env *execenv.Env, opts bugShowOptions, args []string) error { |
| 50 | b, _, err := ResolveSelected(env.Backend, args) |
no test coverage detected