NewUsersCommand creates and returns the cobra command for deleting a username entry.
()
| 9 | |
| 10 | // NewUsersCommand creates and returns the cobra command for deleting a username entry. |
| 11 | func NewUsersCommand() *cobra.Command { |
| 12 | cmd := &cobra.Command{ |
| 13 | Use: "users <username>", |
| 14 | Args: cobra.ExactArgs(1), |
| 15 | Short: "Delete an alternative username", |
| 16 | Long: "Delete an alternative username", |
| 17 | Aliases: []string{"user", "usr"}, |
| 18 | Run: func(_ *cobra.Command, args []string) { |
| 19 | username := args[0] |
| 20 | configuration, err := config.LoadConfig() |
| 21 | if err != nil { |
| 22 | utils.Fatalln(err) |
| 23 | } |
| 24 | controller := control.NewDeleteController(control.TypeUsers, username, configuration) |
| 25 | controller.ExecuteDelete() |
| 26 | }, |
| 27 | } |
| 28 | return cmd |
| 29 | } |