diff options
| author | Ogulcan Celik <ogulcancelik@gmail.com> | 2026-05-20 00:29:53 +0300 |
|---|---|---|
| committer | Ogulcan Celik <ogulcancelik@gmail.com> | 2026-05-20 00:34:27 +0300 |
| commit | 2b97799b6715fd6c355db9c225029765971915e6 (patch) | |
| tree | cb7c2c7093f439ad3460687b88c3e6cf539b64e8 /src/config | |
| parent | ff8e5a14abe445a61dc200fd30a70870c75d183c (diff) | |
feat: add configurable default shell
refs #196
Diffstat (limited to 'src/config')
| -rw-r--r-- | src/config/io.rs | 8 | ||||
| -rw-r--r-- | src/config/model.rs | 21 |
2 files changed, 29 insertions, 0 deletions
diff --git a/src/config/io.rs b/src/config/io.rs index 268a1e8b..07b63d37 100644 --- a/src/config/io.rs +++ b/src/config/io.rs @@ -162,6 +162,14 @@ fn load_live_config_from_str(content: &str) -> Result<LoadedConfig, Vec<String>> ); load_live_section( table, + "terminal", + "terminal config", + &mut diagnostics, + &mut invalid_sections, + |section| config.terminal = section, + ); + load_live_section( + table, "ui", "ui config", &mut diagnostics, diff --git a/src/config/model.rs b/src/config/model.rs index 673eec02..ff3a7b22 100644 --- a/src/config/model.rs +++ b/src/config/model.rs @@ -34,6 +34,13 @@ pub struct ToastConfig { pub delivery: ToastDelivery, } +#[derive(Debug, Default, Deserialize)] +#[serde(default)] +pub struct TerminalConfig { + /// Executable used for new interactive panes. Empty means SHELL, then /bin/sh. + pub default_shell: String, +} + #[derive(Debug, Clone, Copy, PartialEq, Eq, Deserialize, Serialize)] #[serde(rename_all = "snake_case")] pub enum ConfigReloadStatus { @@ -66,6 +73,7 @@ pub fn validated_sidebar_bounds(min: u16, max: u16) -> Option<(u16, u16)> { pub struct Config { pub onboarding: Option<bool>, pub theme: ThemeConfig, + pub terminal: TerminalConfig, pub keys: KeysConfig, pub ui: UiConfig, pub advanced: AdvancedConfig, @@ -298,6 +306,19 @@ mod tests { use super::*; #[test] + fn terminal_default_shell_defaults_empty_and_parses() { + let default_config = Config::default(); + assert!(default_config.terminal.default_shell.is_empty()); + + let toml = r#" +[terminal] +default_shell = "nu" +"#; + let config: Config = toml::from_str(toml).unwrap(); + assert_eq!(config.terminal.default_shell, "nu"); + } + + #[test] fn agent_panel_scope_config_parses() { let toml = r#" [ui] |
