NewAliasUnsetCommand creates and returns the cobra command for unsetting an alias.
()
| 9 | |
| 10 | // NewAliasUnsetCommand creates and returns the cobra command for unsetting an alias. |
| 11 | func NewAliasUnsetCommand() *cobra.Command { |
| 12 | cmd := &cobra.Command{ |
| 13 | Use: "unset <alias>", |
| 14 | Args: cobra.ExactArgs(1), |
| 15 | Short: "Unset the alias", |
| 16 | Long: "Unset the alias", |
| 17 | Run: func(_ *cobra.Command, args []string) { |
| 18 | aliasContent := args[0] |
| 19 | configuration, err := config.LoadConfig() |
| 20 | if err != nil { |
| 21 | utils.Fatalln(err) |
| 22 | } |
| 23 | controller := control.NewAliasController("", configuration, aliasContent) |
| 24 | controller.UnsetAlias() |
| 25 | }, |
| 26 | } |
| 27 | return cmd |
| 28 | } |