From ce79f0183d9fc457ce0fc10fa94e3a1350f33f66 Mon Sep 17 00:00:00 2001 From: Lakelezz <12222135+Lakelezz@users.noreply.github.com> Date: Sun, 9 Sep 2018 13:12:38 +0200 Subject: Suggest similar commands when using help (#377) --- examples/05_command_framework/src/main.rs | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'examples/05_command_framework/src') diff --git a/examples/05_command_framework/src/main.rs b/examples/05_command_framework/src/main.rs index 483d143..647ea56 100644 --- a/examples/05_command_framework/src/main.rs +++ b/examples/05_command_framework/src/main.rs @@ -149,6 +149,11 @@ fn main() { // Some arguments require a `{}` in order to replace it with contextual information. // In this case our `{}` refers to a command's name. .command_not_found_text("Could not find: `{}`.") + // Define the maximum Levenshtein-distance between a searched command-name + // and commands. If the distance is lower than or equal the set distance, + // it will be displayed as a suggestion. + // Setting the distance to 0 will disable suggestions. + .max_levenshtein_distance(3) // On another note, you can set up the help-menu-filter-behaviour. // Here are all possible settings shown on all possible options. // First case is if a user lacks permissions for a command, we can hide the command. -- cgit v1.2.3