NewUsersCommand creates and returns the cobra command for retrieving username entries.
()
| 9 | |
| 10 | // NewUsersCommand creates and returns the cobra command for retrieving username entries. |
| 11 | func NewUsersCommand() *cobra.Command { |
| 12 | cmd := &cobra.Command{ |
| 13 | Use: "users <username>", |
| 14 | Short: "Get alternative usernames", |
| 15 | Long: "Get alternative usernames", |
| 16 | Aliases: []string{"user", "usr"}, |
| 17 | Run: func(_ *cobra.Command, args []string) { |
| 18 | var username string |
| 19 | if len(args) > 0 { |
| 20 | username = args[0] |
| 21 | } |
| 22 | configuration, err := config.LoadConfig() |
| 23 | if err != nil { |
| 24 | utils.Fatalln(err) |
| 25 | } |
| 26 | controller := control.NewGetController(control.TypeUsers, username, configuration) |
| 27 | controller.ExecuteGet() |
| 28 | }, |
| 29 | } |
| 30 | return cmd |
| 31 | } |