diff options
Diffstat (limited to 'src/modules/shell.rs')
-rw-r--r-- | src/modules/shell.rs | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/modules/shell.rs b/src/modules/shell.rs index d8a5f8e0b..0b141ec8a 100644 --- a/src/modules/shell.rs +++ b/src/modules/shell.rs @@ -25,6 +25,7 @@ pub fn module<'a>(context: &'a Context) -> Option<Module<'a>> { Shell::Elvish => Some(config.elvish_indicator), Shell::Tcsh => Some(config.tcsh_indicator), Shell::Nu => Some(config.nu_indicator), + Shell::Xonsh => Some(config.xonsh_indicator), Shell::Unknown => Some(config.unknown_indicator), }, _ => None, @@ -37,6 +38,7 @@ pub fn module<'a>(context: &'a Context) -> Option<Module<'a>> { "ion_indicator" => Some(Ok(config.ion_indicator)), "elvish_indicator" => Some(Ok(config.elvish_indicator)), "tcsh_indicator" => Some(Ok(config.tcsh_indicator)), + "xonsh_indicator" => Some(Ok(config.xonsh_indicator)), "unknown_indicator" => Some(Ok(config.unknown_indicator)), _ => None, }) @@ -280,6 +282,35 @@ mod tests { } #[test] + fn test_xonsh_default_format() { + let expected = Some(format!("{} ", "xsh")); + let actual = ModuleRenderer::new("shell") + .shell(Shell::Xonsh) + .config(toml::toml! { + [shell] + disabled = false + }) + .collect(); + + assert_eq!(expected, actual); + } + + #[test] + fn test_xonsh_custom_format() { + let expected = Some(format!("{} ", Color::Cyan.bold().paint("xonsh"))); + let actual = ModuleRenderer::new("shell") + .shell(Shell::Xonsh) + .config(toml::toml! { + [shell] + xonsh_indicator = "[xonsh](bold cyan)" + disabled = false + }) + .collect(); + + assert_eq!(expected, actual); + } + + #[test] fn test_custom_format_conditional_indicator_match() { let expected = Some(format!("{} ", "B")); let actual = ModuleRenderer::new("shell") |