Skip to content

cli: add --env KEY=VAL to exec #75

@bilby91

Description

@bilby91

devcontainer exec doesn't expose a way to set environment variables for the exec'd process. The library already supports it via `ExecOptions.Env`; we just need to wire a repeatable `--env` (`-e`) flag in `cmd/devcontainer/exec.go` and pass it through.

Shape:

```
devcontainer exec -e FOO=bar -e BAZ=qux -- ./script.sh
```

Parsing: split on the first `=`. Reject entries without `=`. Matches `docker exec` and upstream `@devcontainers/cli` semantics.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions