MCPcopy Index your code
hub / github.com/git-bug/git-bug / newUserShowCommand

Function newUserShowCommand

commands/user/user_show.go:19–41  ·  view source on GitHub ↗
(env *execenv.Env)

Source from the content-addressed store, hash-verified

17}
18
19func newUserShowCommand(env *execenv.Env) *cobra.Command {
20 options := userShowOptions{}
21
22 cmd := &cobra.Command{
23 Use: "user show [USER_ID]",
24 Short: "Display a user identity",
25 PreRunE: execenv.LoadBackendEnsureUser(env),
26 RunE: execenv.CloseBackend(env, func(cmd *cobra.Command, args []string) error {
27 return runUserShow(env, options, args)
28 }),
29 ValidArgsFunction: completion.User(env),
30 }
31
32 flags := cmd.Flags()
33 flags.SortFlags = false
34
35 fields := []string{"email", "humanId", "id", "lastModification", "lastModificationLamports", "login", "metadata", "name"}
36 flags.StringVarP(&options.fields, "field", "f", "",
37 "Select field to display. Valid values are ["+strings.Join(fields, ",")+"]")
38 cmd.RegisterFlagCompletionFunc("field", completion.From(fields))
39
40 return cmd
41}
42
43func runUserShow(env *execenv.Env, opts userShowOptions, args []string) error {
44 if len(args) > 1 {

Callers 1

NewUserCommandFunction · 0.85

Calls 5

LoadBackendEnsureUserFunction · 0.92
CloseBackendFunction · 0.92
UserFunction · 0.92
FromFunction · 0.92
runUserShowFunction · 0.85

Tested by

no test coverage detected