(state *globalState, enabled bool)
| 484 | } |
| 485 | |
| 486 | func toggleEnabledRunE(state *globalState, enabled bool) func(*cobra.Command, []string) error { |
| 487 | return func(cmd *cobra.Command, args []string) error { |
| 488 | name := args[0] |
| 489 | if _, err := providerAPI(state).SetEnabled(context.Background(), name, enabled); err != nil { |
| 490 | if errors.Is(err, providers.ErrNotFound) { |
| 491 | return fmt.Errorf("provider %q not found", name) |
| 492 | } |
| 493 | return err |
| 494 | } |
| 495 | state := "disabled" |
| 496 | if enabled { |
| 497 | state = "enabled" |
| 498 | } |
| 499 | fmt.Fprintf(cmd.OutOrStdout(), "Provider %q %s\n", name, state) |
| 500 | return nil |
| 501 | } |
| 502 | } |
| 503 | |
| 504 | func (a *App) providerRenameCommand(state *globalState) *cobra.Command { |
| 505 | return &cobra.Command{ |
no test coverage detected