Skip to content

feat(dev): --envrc writes the dev line to .envrc for direnv - #329

Merged
HaoZeke merged 3 commits into
mainfrom
feat/dev-envrc-stacked
Nov 19, 2026
Merged

HaoZeke merged 3 commits into
mainfrom
feat/dev-envrc-stacked

Conversation

@HaoZeke

@HaoZeke HaoZeke commented Nov 19, 2026

Copy link
Copy Markdown
Collaborator

eb-local dev --envrc MODULE... writes, in the working directory:

# >>> eb-local dev >>> rerun `eb-local dev --envrc` to change these lines
eval "$(/path/to/eb-local dev MODULE...)"
# <<< eb-local dev <<<
  • The program is named by its own path (a shell direnv starts need not have eb-local on PATH), and --config, --profile, --project and --buildenv are repeated on the line.
  • A block already in the file is replaced; every other line is kept. A file without one gets it appended. A new file is created with mode 0644; an existing one keeps its mode and is replaced atomically.
  • A begin line without its end line is refused and the file is left as it is.
  • Nothing is printed on stdout; stderr says to run direnv allow.

Only variables reach the calling shell, as with any direnv environment.

Checked

The zig workflow on the branch: 574 tests on x86_64 and aarch64 with env --json below it (570 on main). Two new tests: the block is written, replaced, appended and refused as described, and bash sourcing the written file gets EB_LOCAL_DEV_PREFIX from this program's dev lines. Not run against a direnv binary.

Closes #328

The block sits between marker lines eb-local owns, names the program by
its own path and repeats the options that selected the environment. A
later run replaces the block and keeps every other line.
@HaoZeke
HaoZeke merged commit c883b22 into main Nov 19, 2026
9 checks passed
@HaoZeke
HaoZeke deleted the feat/dev-envrc-stacked branch November 19, 2026 15:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

dev: no way to tie a build environment to a directory, or to leave it

1 participant