MCPcopy Create free account
hub / github.com/anchordotdev/cli / exportMethod

Method exportMethod

service/env.go:208–227  ·  view source on GitHub ↗
(ctx context.Context, cfg *cli.Config, drv *ui.Driver, env map[string]string, serviceAPID string)

Source from the content-addressed store, hash-verified

206}
207
208func (c *Env) exportMethod(ctx context.Context, cfg *cli.Config, drv *ui.Driver, env map[string]string, serviceAPID string) error {
209 var b strings.Builder
210
211 var keys []string
212 for key := range env {
213 keys = append(keys, key)
214 }
215 sort.Strings(keys)
216 for _, key := range keys {
217 fmt.Fprintf(&b, "export %s=\"%s\"\n", key, env[key])
218 }
219 clipboardErr := c.Clipboard.WriteAll(b.String())
220
221 drv.Activate(ctx, &models.EnvClipboard{
222 InClipboard: (clipboardErr == nil),
223 Service: serviceAPID,
224 })
225
226 return nil
227}
228
229func (c *Env) dotenvMethod(ctx context.Context, cfg *cli.Config, drv *ui.Driver, env map[string]string, serviceAPID string) error {
230 var b bytes.Buffer

Callers 1

PerformMethod · 0.95

Calls 3

ActivateMethod · 0.80
WriteAllMethod · 0.65
StringMethod · 0.65

Tested by

no test coverage detected