From 196cc8aa3980d67e8ddb0d80bbdd92720adc0aec Mon Sep 17 00:00:00 2001 From: Kid <44045911+kidonng@users.noreply.github.com> Date: Sun, 4 Jul 2021 22:32:47 +0800 Subject: [PATCH] fix(dotnet): make default format consistent with other modules (#2853) Add via prefix to dotnet modules' default format config. --- docs/config/README.md | 6 +++--- src/configs/dotnet.rs | 2 +- src/modules/dotnet.rs | 42 ++++++++++++++++++++++++++++++------------ 3 files changed, 34 insertions(+), 16 deletions(-) diff --git a/docs/config/README.md b/docs/config/README.md index 0c068b78..522b3d9b 100644 --- a/docs/config/README.md +++ b/docs/config/README.md @@ -419,7 +419,7 @@ look at [this example](#with-custom-error-shape). ::: warning -`vicmd_symbol` is only supported in fish and zsh. +`vicmd_symbol` is only supported in fish and zsh. ::: @@ -859,7 +859,7 @@ when there is a csproj file in the current directory. | Option | Default | Description | | ------------------- | ------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------- | -| `format` | `"[$symbol($version )(🎯 $tfm )]($style)"` | The format for the module. | +| `format` | `"via [$symbol($version )(🎯 $tfm )]($style)"` | The format for the module. | | `version_format` | `"v${raw}"` | The version format. Available vars are `raw`, `major`, `minor`, & `patch` | | `symbol` | `".NET "` | The symbol used before displaying the version of dotnet. | | `heuristic` | `true` | Use faster version detection to keep starship snappy. | @@ -2295,7 +2295,7 @@ python_binary = ["./venv/bin/python", "python", "python3", "python2"] ## R -The `rlang` module shows the currently installed version of R. The module will be shown if +The `rlang` module shows the currently installed version of R. The module will be shown if any of the following conditions are met: - The current directory contains a file with the `.R` extension. diff --git a/src/configs/dotnet.rs b/src/configs/dotnet.rs index e8558e39..0d29e178 100644 --- a/src/configs/dotnet.rs +++ b/src/configs/dotnet.rs @@ -19,7 +19,7 @@ pub struct DotnetConfig<'a> { impl<'a> Default for DotnetConfig<'a> { fn default() -> Self { DotnetConfig { - format: "[$symbol($version )(🎯 $tfm )]($style)", + format: "via [$symbol($version )(🎯 $tfm )]($style)", version_format: "v${raw}", symbol: ".NET ", style: "blue bold", diff --git a/src/modules/dotnet.rs b/src/modules/dotnet.rs index 3d034788..68d03ecd 100644 --- a/src/modules/dotnet.rs +++ b/src/modules/dotnet.rs @@ -364,7 +364,10 @@ mod tests { touch_path(&workspace, "Directory.Build.props", None)?; expect_output( &workspace.path(), - Some(format!("{}", Color::Blue.bold().paint(".NET v3.1.103 "))), + Some(format!( + "via {}", + Color::Blue.bold().paint(".NET v3.1.103 ") + )), ); workspace.close() } @@ -375,7 +378,10 @@ mod tests { touch_path(&workspace, "Directory.Build.targets", None)?; expect_output( &workspace.path(), - Some(format!("{}", Color::Blue.bold().paint(".NET v3.1.103 "))), + Some(format!( + "via {}", + Color::Blue.bold().paint(".NET v3.1.103 ") + )), ); workspace.close() } @@ -386,7 +392,10 @@ mod tests { touch_path(&workspace, "Packages.props", None)?; expect_output( &workspace.path(), - Some(format!("{}", Color::Blue.bold().paint(".NET v3.1.103 "))), + Some(format!( + "via {}", + Color::Blue.bold().paint(".NET v3.1.103 ") + )), ); workspace.close() } @@ -407,7 +416,7 @@ mod tests { expect_output( &workspace.path(), Some(format!( - "{}", + "via {}", Color::Blue.bold().paint(".NET v3.1.103 🎯 netstandard2.0 ") )), ); @@ -420,7 +429,10 @@ mod tests { touch_path(&workspace, "project.fsproj", None)?; expect_output( &workspace.path(), - Some(format!("{}", Color::Blue.bold().paint(".NET v3.1.103 "))), + Some(format!( + "via {}", + Color::Blue.bold().paint(".NET v3.1.103 ") + )), ); workspace.close() } @@ -431,7 +443,10 @@ mod tests { touch_path(&workspace, "project.xproj", None)?; expect_output( &workspace.path(), - Some(format!("{}", Color::Blue.bold().paint(".NET v3.1.103 "))), + Some(format!( + "via {}", + Color::Blue.bold().paint(".NET v3.1.103 ") + )), ); workspace.close() } @@ -442,7 +457,10 @@ mod tests { touch_path(&workspace, "project.json", None)?; expect_output( &workspace.path(), - Some(format!("{}", Color::Blue.bold().paint(".NET v3.1.103 "))), + Some(format!( + "via {}", + Color::Blue.bold().paint(".NET v3.1.103 ") + )), ); workspace.close() } @@ -454,7 +472,7 @@ mod tests { touch_path(&workspace, "global.json", Some(&global_json))?; expect_output( &workspace.path(), - Some(format!("{}", Color::Blue.bold().paint(".NET v1.2.3 "))), + Some(format!("via {}", Color::Blue.bold().paint(".NET v1.2.3 "))), ); workspace.close() } @@ -469,7 +487,7 @@ mod tests { expect_output( &workspace.path().join("project"), Some(format!( - "{}", + "via {}", Color::Blue.bold().paint(".NET v1.2.3 🎯 netstandard2.0 ") )), ); @@ -490,7 +508,7 @@ mod tests { expect_output( &workspace.path().join("deep/path/to/project"), Some(format!( - "{}", + "via {}", Color::Blue.bold().paint(".NET v1.2.3 🎯 netstandard2.0 ") )), ); @@ -505,7 +523,7 @@ mod tests { expect_output( workspace.path(), Some(format!( - "{}", + "via {}", Color::Blue.bold().paint(".NET v3.1.103 🎯 netstandard2.0 ") )), ); @@ -520,7 +538,7 @@ mod tests { expect_output( workspace.path(), Some(format!( - "{}", + "via {}", Color::Blue .bold() .paint(".NET v3.1.103 🎯 netstandard2.0;net461 ")