MCPcopy Create free account
hub / github.com/git-bug/git-bug / newBugShowCommand

Function newBugShowCommand

commands/bug/bug_show.go:22–47  ·  view source on GitHub ↗
(env *execenv.Env)

Source from the content-addressed store, hash-verified

20}
21
22func 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
49func runBugShow(env *execenv.Env, opts bugShowOptions, args []string) error {
50 b, _, err := ResolveSelected(env.Backend, args)

Callers 1

NewBugCommandFunction · 0.85

Calls 5

LoadBackendFunction · 0.92
CloseBackendFunction · 0.92
FromFunction · 0.92
runBugShowFunction · 0.85
BugCompletionFunction · 0.85

Tested by

no test coverage detected