MCPcopy Create free account
hub / github.com/Chat2AnyLLM/code-agent-manager / providerRenameCommand

Method providerRenameCommand

internal/cli/provider_cmd.go:504–523  ·  view source on GitHub ↗
(state *globalState)

Source from the content-addressed store, hash-verified

502}
503
504func (a *App) providerRenameCommand(state *globalState) *cobra.Command {
505 return &cobra.Command{
506 Use: "rename OLD NEW",
507 Short: "Rename a provider entry",
508 Args: cobra.ExactArgs(2),
509 RunE: func(cmd *cobra.Command, args []string) error {
510 if _, err := providerAPI(state).Rename(context.Background(), args[0], args[1]); err != nil {
511 if errors.Is(err, providers.ErrNotFound) {
512 return fmt.Errorf("provider %q not found", args[0])
513 }
514 if errors.Is(err, providers.ErrAlreadyExists) {
515 return fmt.Errorf("provider %q already exists", args[1])
516 }
517 return err
518 }
519 fmt.Fprintf(cmd.OutOrStdout(), "Renamed %q to %q\n", args[0], args[1])
520 return nil
521 },
522 }
523}
524
525// parseListFlag interprets a value like "+a,b", "-x", "=a,b", or "a,b".
526// When add is true (the flag is being parsed for `add`), the leading sigil

Callers 1

providerCommandMethod · 0.95

Calls 2

providerAPIFunction · 0.85
RenameMethod · 0.45

Tested by

no test coverage detected