Skip to content

feat(shell): add shell.env to inject environment variables#73

Open
roramirez wants to merge 1 commit into
mainfrom
feat/config-shell-env
Open

feat(shell): add shell.env to inject environment variables#73
roramirez wants to merge 1 commit into
mainfrom
feat/config-shell-env

Conversation

@roramirez

Copy link
Copy Markdown
Owner

Summary

Adds a TOML-only shell.env configuration list that injects environment variables into every spawned shell. Format: env = [["VAR", "value"], ["VAR2", "value2"]]. This is intentionally not editable in the in-app TUI config panel, but is preserved across TUI saves.

Changes

  • src/config/mod.rs: add #[serde(default)] pub env: Vec<(String, String)> to ShellConfig (empty vec by default).
  • src/pty/session.rs: spawn_with_shell gains an env: &[(String, String)] parameter; each pair is applied via cmd.env(k, v) after TERM. spawn passes &[].
  • src/pane_ops.rs: pass &self.state.config.shell.env when spawning a pane shell.
  • src/config/tui_config.rs: carry shell.env through the config-panel round-trip (non-editable) so saving from the TUI does not wipe it.
  • assets/config.toml, README.md, doc/SPEC.md: documented commented example and config table entry; noted it is TOML-only.
  • CHANGELOG.md: ### Added entry.
  • Tests: pty env-injection test, config round-trip/deserialize/default tests; updated all spawn_with_shell callers.

How to test

  • cargo test — includes env_vars_are_injected_into_shell (spawns /bin/sh, injects MMTERM_TEST_ENV=hello, asserts output) and shell_env_* config tests.
  • cargo clippy --locked -- -D warnings and cargo fmt --check are clean.
  • Manual: add env = [["EDITOR", "nvim"]] under [shell] in config.toml, launch mmterm, run echo $EDITOR in a pane.

Add a TOML-only `shell.env` list (`[["VAR", "value"], ...]`) that is
applied to every spawned shell via CommandBuilder. The list is carried
through the TUI config panel round-trip but is not editable there.
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.

1 participant