(cmd *cobra.Command, args []string)
| 285 | } |
| 286 | |
| 287 | func runAliasRemoveCommand(cmd *cobra.Command, args []string) (commandErr error) { |
| 288 | telemetry.TrackCommand(cmd.Context(), "alias", append([]string{"remove"}, args...)) |
| 289 | defer func() { |
| 290 | telemetry.TrackCommandError(cmd.Context(), "alias", append([]string{"remove"}, args...), commandErr) |
| 291 | }() |
| 292 | |
| 293 | out := cli.NewPrinter(cmd.OutOrStdout()) |
| 294 | name := args[0] |
| 295 | |
| 296 | cfg, err := userconfig.Load() |
| 297 | if err != nil { |
| 298 | return fmt.Errorf("failed to load config: %w", err) |
| 299 | } |
| 300 | |
| 301 | if !cfg.DeleteAlias(name) { |
| 302 | return fmt.Errorf("alias '%s' not found", name) |
| 303 | } |
| 304 | |
| 305 | if err := cfg.Save(); err != nil { |
| 306 | return fmt.Errorf("failed to save config: %w", err) |
| 307 | } |
| 308 | |
| 309 | out.Printf("Alias '%s' removed successfully\n", name) |
| 310 | return nil |
| 311 | } |
nothing calls this directly
no test coverage detected