fix(dotnet): make default format consistent with other modules (#2853)

Add via prefix to dotnet modules' default format config.
This commit is contained in:
Kid 2021-07-04 22:32:47 +08:00 committed by GitHub
parent bdac951168
commit 196cc8aa39
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 34 additions and 16 deletions

View File

@ -859,7 +859,7 @@ when there is a csproj file in the current directory.
| Option | Default | Description | | 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` | | `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. | | `symbol` | `".NET "` | The symbol used before displaying the version of dotnet. |
| `heuristic` | `true` | Use faster version detection to keep starship snappy. | | `heuristic` | `true` | Use faster version detection to keep starship snappy. |

View File

@ -19,7 +19,7 @@ pub struct DotnetConfig<'a> {
impl<'a> Default for DotnetConfig<'a> { impl<'a> Default for DotnetConfig<'a> {
fn default() -> Self { fn default() -> Self {
DotnetConfig { DotnetConfig {
format: "[$symbol($version )(🎯 $tfm )]($style)", format: "via [$symbol($version )(🎯 $tfm )]($style)",
version_format: "v${raw}", version_format: "v${raw}",
symbol: ".NET ", symbol: ".NET ",
style: "blue bold", style: "blue bold",

View File

@ -364,7 +364,10 @@ mod tests {
touch_path(&workspace, "Directory.Build.props", None)?; touch_path(&workspace, "Directory.Build.props", None)?;
expect_output( expect_output(
&workspace.path(), &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() workspace.close()
} }
@ -375,7 +378,10 @@ mod tests {
touch_path(&workspace, "Directory.Build.targets", None)?; touch_path(&workspace, "Directory.Build.targets", None)?;
expect_output( expect_output(
&workspace.path(), &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() workspace.close()
} }
@ -386,7 +392,10 @@ mod tests {
touch_path(&workspace, "Packages.props", None)?; touch_path(&workspace, "Packages.props", None)?;
expect_output( expect_output(
&workspace.path(), &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() workspace.close()
} }
@ -407,7 +416,7 @@ mod tests {
expect_output( expect_output(
&workspace.path(), &workspace.path(),
Some(format!( Some(format!(
"{}", "via {}",
Color::Blue.bold().paint(".NET v3.1.103 🎯 netstandard2.0 ") Color::Blue.bold().paint(".NET v3.1.103 🎯 netstandard2.0 ")
)), )),
); );
@ -420,7 +429,10 @@ mod tests {
touch_path(&workspace, "project.fsproj", None)?; touch_path(&workspace, "project.fsproj", None)?;
expect_output( expect_output(
&workspace.path(), &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() workspace.close()
} }
@ -431,7 +443,10 @@ mod tests {
touch_path(&workspace, "project.xproj", None)?; touch_path(&workspace, "project.xproj", None)?;
expect_output( expect_output(
&workspace.path(), &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() workspace.close()
} }
@ -442,7 +457,10 @@ mod tests {
touch_path(&workspace, "project.json", None)?; touch_path(&workspace, "project.json", None)?;
expect_output( expect_output(
&workspace.path(), &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() workspace.close()
} }
@ -454,7 +472,7 @@ mod tests {
touch_path(&workspace, "global.json", Some(&global_json))?; touch_path(&workspace, "global.json", Some(&global_json))?;
expect_output( expect_output(
&workspace.path(), &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() workspace.close()
} }
@ -469,7 +487,7 @@ mod tests {
expect_output( expect_output(
&workspace.path().join("project"), &workspace.path().join("project"),
Some(format!( Some(format!(
"{}", "via {}",
Color::Blue.bold().paint(".NET v1.2.3 🎯 netstandard2.0 ") Color::Blue.bold().paint(".NET v1.2.3 🎯 netstandard2.0 ")
)), )),
); );
@ -490,7 +508,7 @@ mod tests {
expect_output( expect_output(
&workspace.path().join("deep/path/to/project"), &workspace.path().join("deep/path/to/project"),
Some(format!( Some(format!(
"{}", "via {}",
Color::Blue.bold().paint(".NET v1.2.3 🎯 netstandard2.0 ") Color::Blue.bold().paint(".NET v1.2.3 🎯 netstandard2.0 ")
)), )),
); );
@ -505,7 +523,7 @@ mod tests {
expect_output( expect_output(
workspace.path(), workspace.path(),
Some(format!( Some(format!(
"{}", "via {}",
Color::Blue.bold().paint(".NET v3.1.103 🎯 netstandard2.0 ") Color::Blue.bold().paint(".NET v3.1.103 🎯 netstandard2.0 ")
)), )),
); );
@ -520,7 +538,7 @@ mod tests {
expect_output( expect_output(
workspace.path(), workspace.path(),
Some(format!( Some(format!(
"{}", "via {}",
Color::Blue Color::Blue
.bold() .bold()
.paint(".NET v3.1.103 🎯 netstandard2.0;net461 ") .paint(".NET v3.1.103 🎯 netstandard2.0;net461 ")