mirror of
https://github.com/clap-rs/clap
synced 2024-12-12 13:52:34 +00:00
fix(error): Don't highlight 'similar'
This commit is contained in:
parent
8f45d2f95a
commit
58615a1306
2 changed files with 9 additions and 5 deletions
|
@ -18,6 +18,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
|
|||
<!-- next-header -->
|
||||
## [Unreleased] - ReleaseDate
|
||||
|
||||
### Fixes
|
||||
|
||||
- Don't highlight uninteresting parts of the error message
|
||||
|
||||
## [4.2.0] - 2023-03-28
|
||||
|
||||
### Compatibility
|
||||
|
|
|
@ -427,21 +427,21 @@ fn try_help(styled: &mut StyledStr, help: Option<&str>) {
|
|||
|
||||
#[cfg(feature = "error-context")]
|
||||
fn did_you_mean(styled: &mut StyledStr, context: &str, valid: &ContextValue) {
|
||||
styled.none(TAB);
|
||||
styled.good("tip:");
|
||||
if let ContextValue::String(valid) = valid {
|
||||
styled.none(TAB);
|
||||
styled.good("tip: a similar ");
|
||||
styled.none(" a similar ");
|
||||
styled.none(context);
|
||||
styled.none(" exists: '");
|
||||
styled.good(valid);
|
||||
styled.none("'");
|
||||
} else if let ContextValue::Strings(valid) = valid {
|
||||
styled.none(TAB);
|
||||
if valid.len() == 1 {
|
||||
styled.good("tip: a similar ");
|
||||
styled.none(" a similar ");
|
||||
styled.none(context);
|
||||
styled.none(" exists: ");
|
||||
} else {
|
||||
styled.good("tip: some similar ");
|
||||
styled.none(" some similar ");
|
||||
styled.none(context);
|
||||
styled.none("s exist: ");
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue