(env *execenv.Env)
| 17 | } |
| 18 | |
| 19 | func 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 | |
| 43 | func runUserShow(env *execenv.Env, opts userShowOptions, args []string) error { |
| 44 | if len(args) > 1 { |
no test coverage detected