Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve phrasing for "unknown goal" and "unknown flag" errors. (#11664)
Implements the same "did you mean...?" phrasing as specified in #11564, and creates a new function as a component of the MaybeColor class that can be used to print this same phrasing for future help cases if needed. Adds a unit test for this function as well. [ci skip-rust] [ci skip-build-wheels]
- Loading branch information
1 parent
0e1f1f9
commit 023cd1f
Showing
5 changed files
with
37 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# Copyright 2015 Pants project contributors (see CONTRIBUTORS.md). | ||
# Licensed under the Apache License, Version 2.0 (see LICENSE). | ||
|
||
from pants.help.maybe_color import MaybeColor | ||
|
||
|
||
def test_produce_fmt_matches() -> None: | ||
dummy = MaybeColor(color=False) | ||
diff_ex = ["match1", "match2", "match3"] | ||
one_match = dummy._format_did_you_mean_matches(diff_ex[:1]) | ||
assert one_match == "match1" | ||
two_match = dummy._format_did_you_mean_matches(diff_ex[:2]) | ||
assert two_match == "match1 or match2" | ||
three_match = dummy._format_did_you_mean_matches(diff_ex[:3]) | ||
assert three_match == "match1, match2, or match3" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters