Skip to content

feat(env): --json prints the change the env and dev lines make - #326

Merged
HaoZeke merged 3 commits into
mainfrom
feat/env-json
Nov 19, 2026
Merged

HaoZeke merged 3 commits into
mainfrom
feat/env-json

Conversation

@HaoZeke

@HaoZeke HaoZeke commented Nov 19, 2026

Copy link
Copy Markdown
Collaborator

eb-local env --json and eb-local dev --json run their lines in a bash child and print how its environment then differs from the caller's, in place of the lines:

{"schema_version":1,"kind":"env","set":[{"name":"EESSI_USER_INSTALL","value":"/home/u/eessi"}],"unset":["EASYBUILD_PREFIX"]}
  • set and unset are sorted by name. A variable the caller already has with the same value is in neither.
  • bash's own variables (_, SHLVL, PWD, OLDPWD) and exported functions (BASH_FUNC_*) are left out.
  • What the lines print goes to stderr; if they fail in bash, nothing is printed and the status is 1.
  • The reference has a nushell wrapper (from json, load-env, hide-env), checked with nu 0.117.0.

Only variables cross over. Lmod's module function stays in the bash child, so modules are named on the dev line.

Checked

The zig workflow on the branch: 572 tests on x86_64 and aarch64 (570 on main), the same 17 skipped. Two new tests: env --json against a caller environment with variables the lines unset and keep, and dev --json.

Closes #325

eb-local runs the lines in a bash child and prints how its environment
then differs from the caller's, as set and unset lists in one line of
JSON. A shell that cannot evaluate POSIX text applies that; the
reference has a nushell wrapper. Shell functions such as Lmod's module
are not variables and do not cross over.
Pygments has no nu lexer, and the site build treats the warning as an
error.
@HaoZeke
HaoZeke merged commit f689976 into main Nov 19, 2026
9 checks passed
@HaoZeke
HaoZeke deleted the feat/env-json branch November 19, 2026 14:58
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.

env, dev: a shell that cannot evaluate POSIX lines cannot use them

1 participant