diff options
author | Thomas O'Donnell <andytom@users.noreply.github.com> | 2021-01-16 13:27:02 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-16 13:27:02 +0100 |
commit | 12494da38ae05a523f1292b1a9c95767475a388f (patch) | |
tree | 4f044edae98e5e1cc1003c2cbbfa56f0ad831409 /src | |
parent | 5722b17f9e102ae62ba5ace3da93981b9fa4b09b (diff) |
fix(cmake): Fix spacing with missing variable (#2135)
This fixes the additional space when the `version` variable can't be
populated.
Diffstat (limited to 'src')
-rw-r--r-- | src/configs/cmake.rs | 2 | ||||
-rw-r--r-- | src/modules/cmake.rs | 6 |
2 files changed, 4 insertions, 4 deletions
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<Module<'a>> { 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() } |