Description Usage Arguments Value Examples
Suggest alternative name by minimizing Levenshtein edit distance between valid and invalid arguments
1 2 3 4 5 6 | cmd_help_flags_similar(
command_flag_names,
flags,
.fun = NULL,
distance_cutoff = 3L
)
|
command_flag_names |
character vector of valid names (can be output of |
flags |
a vector names correspond to values to be checked against |
.fun |
optional function to apply to |
distance_cutoff |
Levenshtein edit distance beyond which to suggest ??? instead of most similar argument (default = 3). Setting this too liberally will result in nonsensical suggestions. |
named vector where names are names from flags
and their values are the suggested best match from command_flag_names
1 2 3 4 5 6 7 8 9 10 | # with a flagsList, need to pass names()
flagsList <- list("output" = "somevalue", "missplld" = "anotherValue")
cmd_help_flags_similar(c("output", "misspelled"), names(flagsList))
command_flags <- c("long-flag-name")
flags <- c("long_flag_naee")
cmd_help_flags_similar(command_flags, flags, .fun = ~{gsub("-", "_", .x)})
# returns NULL if no errors
cmd_help_flags_similar(c("test"), "test")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.