Skip to content

Commit

Permalink
fix(error): Don't highlight 'similar'
Browse files Browse the repository at this point in the history
  • Loading branch information
epage committed Mar 28, 2023
1 parent 8f45d2f commit 58615a1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Expand Up @@ -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
Expand Down
10 changes: 5 additions & 5 deletions clap_builder/src/error/format.rs
Expand Up @@ -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: ");
}
Expand Down

0 comments on commit 58615a1

Please sign in to comment.