feat(shell): add shell.env to inject environment variables#73
Open
roramirez wants to merge 1 commit into
Open
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a TOML-only
shell.envconfiguration 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)>toShellConfig(empty vec by default).src/pty/session.rs:spawn_with_shellgains anenv: &[(String, String)]parameter; each pair is applied viacmd.env(k, v)afterTERM.spawnpasses&[].src/pane_ops.rs: pass&self.state.config.shell.envwhen spawning a pane shell.src/config/tui_config.rs: carryshell.envthrough 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:### Addedentry.spawn_with_shellcallers.How to test
cargo test— includesenv_vars_are_injected_into_shell(spawns/bin/sh, injectsMMTERM_TEST_ENV=hello, asserts output) andshell_env_*config tests.cargo clippy --locked -- -D warningsandcargo fmt --checkare clean.env = [["EDITOR", "nvim"]]under[shell]inconfig.toml, launch mmterm, runecho $EDITORin a pane.