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

Method providerShowCommand

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

Source from the content-addressed store, hash-verified

132}
133
134func (a *App) providerShowCommand(state *globalState) *cobra.Command {
135 var revealKey bool
136 cmd := &cobra.Command{
137 Use: "show NAME",
138 Short: "Show the configuration for a single provider",
139 Args: cobra.ExactArgs(1),
140 RunE: func(cmd *cobra.Command, args []string) error {
141 provider, err := providerAPI(state).Show(context.Background(), args[0])
142 if err != nil {
143 return fmt.Errorf("provider %q not found (try 'cam provider list')", args[0])
144 }
145 out := cmd.OutOrStdout()
146 payload := map[string]any{
147 "name": provider.Name,
148 "endpoint": provider.Endpoint,
149 "api_key_env": provider.APIKeyEnv,
150 "supported_client": provider.SupportedClient,
151 "list_of_models": provider.Models,
152 "list_models_cmd": provider.ListModelsCmd,
153 "use_proxy": provider.UseProxy,
154 "keep_proxy_config": provider.KeepProxyConfig,
155 "enabled": provider.Enabled,
156 "description": provider.Description,
157 }
158 // Resolve the key the same way apply/launch does: a stored literal
159 // key wins, otherwise fall back to the named env var.
160 resolved := provider.APIKey
161 if resolved == "" && provider.APIKeyEnv != "" {
162 resolved = os.Getenv(provider.APIKeyEnv)
163 }
164 if resolved != "" {
165 if revealKey {
166 payload["api_key"] = resolved
167 } else {
168 payload["api_key"] = providers.MaskedAPIKey(resolved)
169 }
170 }
171 return writeJSON(out, payload)
172 },
173 }
174 cmd.Flags().BoolVar(&revealKey, "reveal-key", false, "Show the resolved API key instead of masking it")
175 return cmd
176}
177
178// addOrUpdateFlags is the common flag set shared by `add` and `update`. The
179// returned pointers stay live until cobra has parsed args; the bool-set

Callers 1

providerCommandMethod · 0.95

Calls 4

MaskedAPIKeyFunction · 0.92
providerAPIFunction · 0.85
writeJSONFunction · 0.70
ShowMethod · 0.45

Tested by

no test coverage detected