diff --git a/docs/config/README.md b/docs/config/README.md index ff0a0aade..427b90f45 100644 --- a/docs/config/README.md +++ b/docs/config/README.md @@ -444,12 +444,12 @@ The `cmake` module shows the currently installed version of CMake if any of the ### Options -| Option | Default | Description | -| ---------- | ---------------------------------- | -------------------------------------------- | -| `format` | `"via [$symbol$version]($style) "` | The format for the module. | -| `symbol` | `"喝 "` | The symbol used before the version of cmake. | -| `style` | `"bold blue"` | The style for the module. | -| `disabled` | `false` | Disables the `cmake` module. | +| Option | Default | Description | +| ---------- | ------------------------------------ | -------------------------------------------- | +| `format` | `"via [$symbol($version )]($style)"` | The format for the module. | +| `symbol` | `"喝 "` | The symbol used before the version of cmake. | +| `style` | `"bold blue"` | The style for the module. | +| `disabled` | `false` | Disables the `cmake` module. | ### Variables diff --git a/src/configs/cmake.rs b/src/configs/cmake.rs index df1ed53b2..58c69d423 100644 --- a/src/configs/cmake.rs +++ b/src/configs/cmake.rs @@ -13,7 +13,7 @@ pub struct CMakeConfig<'a> { impl<'a> RootModuleConfig<'a> for CMakeConfig<'a> { fn new() -> Self { CMakeConfig { - format: "via [$symbol$version]($style) ", + format: "via [$symbol($version )]($style)", symbol: "喝 ", style: "bold blue", disabled: false, diff --git a/src/modules/cmake.rs b/src/modules/cmake.rs index e15e41868..aef0a8ce5 100644 --- a/src/modules/cmake.rs +++ b/src/modules/cmake.rs @@ -7,7 +7,7 @@ use crate::utils; /// Creates a module with the current CMake version /// /// Will display the CMake version if any of the following criteria are met: -/// - The current directory contains a `CMakeLists.txt` file +/// - The current directory contains a `CMakeLists.txt` or `CMakeCache.txt` pub fn module<'a>(context: &'a Context) -> Option> { let is_cmake_project = context .try_begin_scan()? @@ -77,7 +77,7 @@ mod tests { let dir = tempfile::tempdir()?; File::create(dir.path().join("CMakeLists.txt"))?.sync_all()?; let actual = ModuleRenderer::new("cmake").path(dir.path()).collect(); - let expected = Some(format!("via {} ", Color::Blue.bold().paint("喝 v3.17.3"))); + let expected = Some(format!("via {}", Color::Blue.bold().paint("喝 v3.17.3 "))); assert_eq!(expected, actual); dir.close() } @@ -87,7 +87,7 @@ mod tests { let dir = tempfile::tempdir()?; File::create(dir.path().join("CMakeCache.txt"))?.sync_all()?; let actual = ModuleRenderer::new("cmake").path(dir.path()).collect(); - let expected = Some(format!("via {} ", Color::Blue.bold().paint("喝 v3.17.3"))); + let expected = Some(format!("via {}", Color::Blue.bold().paint("喝 v3.17.3 "))); assert_eq!(expected, actual); dir.close() }