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

Method dotenvMethod

service/env.go:229–248  ·  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

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
231
232 var keys []string
233 for key := range env {
234 keys = append(keys, key)
235 }
236 sort.Strings(keys)
237 for _, key := range keys {
238 fmt.Fprintf(&b, "%s=\"%s\"\n", key, env[key])
239 }
240 clipboardErr := c.Clipboard.WriteAll(b.String())
241
242 drv.Activate(ctx, &models.EnvDotenv{
243 InClipboard: (clipboardErr == nil),
244 Service: serviceAPID,
245 })
246
247 return nil
248}
249
250func (c *Env) displayMethod(ctx context.Context, drv *ui.Driver, env map[string]string, serviceAPID string) error {
251 var b strings.Builder

Callers 1

PerformMethod · 0.95

Calls 3

ActivateMethod · 0.80
WriteAllMethod · 0.65
StringMethod · 0.65

Tested by

no test coverage detected