Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Suggest typo fixes in
arg_match()
(#913)
Fixes #798
- Loading branch information
Showing
5 changed files
with
75 additions
and
6 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
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,35 @@ | ||
> myarg <- "continuuos" | ||
> arg_match(myarg, c("discrete", "continuous")) | ||
Error: `myarg` must be one of "discrete" or "continuous" | ||
Did you mean "continuous"? | ||
|
||
> myarg <- "fou" | ||
> arg_match(myarg, c("bar", "foo")) | ||
Error: `myarg` must be one of "bar" or "foo" | ||
Did you mean "foo"? | ||
|
||
> myarg <- "fu" | ||
> arg_match(myarg, c("ba", "fo")) | ||
Error: `myarg` must be one of "ba" or "fo" | ||
Did you mean "fo"? | ||
|
||
|
||
No suggestion when the edit distance is too large | ||
================================================= | ||
|
||
> myarg <- "foobaz" | ||
> arg_match(myarg, c("fooquxs", "discrete")) | ||
Error: `myarg` must be one of "fooquxs" or "discrete" | ||
|
||
> myarg <- "a" | ||
> arg_match(myarg, c("b", "c")) | ||
Error: `myarg` must be one of "b" or "c" | ||
|
||
|
||
Even with small possible typos, if there's a match it returns the match | ||
======================================================================= | ||
|
||
> myarg <- "bas" | ||
> arg_match(myarg, c("foo", "baz", "bas")) | ||
[1] "bas" | ||
|