feat(shell): add startup_command run in each new pane#83
Open
roramirez wants to merge 1 commit into
Open
Conversation
Write a configurable command to every newly spawned interactive pane (new tab / split) right after the shell starts. Restored session panes pass run_startup=false so the command is not re-run on restore.
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
shell.startup_commandconfig option. When set, the command is written to every newly spawned interactive pane (new tab or split) right after the shell starts — useful for e.g.ssh myserver. The command is intentionally not re-run for panes reconstructed from a saved session on restore.Changes
src/config/mod.rs: addstartup_command: Option<String>toShellConfig(#[serde(default)], defaults toNone).src/pane_ops.rs:spawn_pane_intogains arun_startup: boolparameter. Interactive callers (spawn_pane,new_tab) passtrue; restore callers insrc/restore.rspassfalse. Whentrueand the config value isSome(non-empty), the command +\nis written to the new pane's PTY.src/config/tui_config.rs: addF_STARTUP_COMMANDfield (Startup Command) to the in-app config editor, with empty→Nonemapping inbuild_config.assets/config.toml,README.md,doc/SPEC.md: document the option (commented example + spec table row and prose).CHANGELOG.md: add entry under## [Unreleased]→### Added.config_test.rs), empty→None / non-empty→Some decision through the config editor (tui_config_test.rs), and updated field-count / index-contiguity / navigation-clamp asserts.Note on coverage: the empty→None/Some decision and config serialization round-trip are unit-tested. The end-to-end PTY-write path in
spawn_pane_intorequires a fully constructedApp(window + renderer) and is not unit-tested; the write itself uses the existing, already-testedPtySession::write_input.How to test
~/.config/mmterm/config.toml:restore_session, save a session withCtrl+Q, relaunch — restored panes do not re-run the command.cargo test— config round-trip and decision tests pass;cargo clippy --locked -- -D warningsis clean.