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

Function NewUserCommand

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

Source from the content-addressed store, hash-verified

17}
18
19func NewUserCommand(env *execenv.Env) *cobra.Command {
20 options := userOptions{}
21
22 cmd := &cobra.Command{
23 Use: "user",
24 Short: "List identities",
25 PreRunE: execenv.LoadBackend(env),
26 RunE: execenv.CloseBackend(env, func(cmd *cobra.Command, args []string) error {
27 return runUser(env, options)
28 }),
29 }
30
31 cmd.AddCommand(newUserNewCommand(env))
32 cmd.AddCommand(newUserShowCommand(env))
33 cmd.AddCommand(newUserAdoptCommand(env))
34
35 flags := cmd.Flags()
36 flags.SortFlags = false
37
38 flags.StringVarP(&options.format, "format", "f", "default",
39 "Select the output formatting style. Valid values are [default,json]")
40 cmd.RegisterFlagCompletionFunc("format", completion.From([]string{"default", "json"}))
41
42 return cmd
43}
44
45func runUser(env *execenv.Env, opts userOptions) error {
46 ids := env.Backend.Identities().AllIds()

Callers

nothing calls this directly

Calls 7

LoadBackendFunction · 0.92
CloseBackendFunction · 0.92
FromFunction · 0.92
runUserFunction · 0.85
newUserNewCommandFunction · 0.85
newUserShowCommandFunction · 0.85
newUserAdoptCommandFunction · 0.85

Tested by

no test coverage detected