aboutsummaryrefslogtreecommitdiff
path: root/examples/05_command_framework
diff options
context:
space:
mode:
authorLakelezz <[email protected]>2018-09-09 13:12:38 +0200
committerGitHub <[email protected]>2018-09-09 13:12:38 +0200
commitce79f0183d9fc457ce0fc10fa94e3a1350f33f66 (patch)
tree71581b64458327fa533aba59d07569a459833d67 /examples/05_command_framework
parentAdd Member::user_id (diff)
downloadserenity-ce79f0183d9fc457ce0fc10fa94e3a1350f33f66.tar.xz
serenity-ce79f0183d9fc457ce0fc10fa94e3a1350f33f66.zip
Suggest similar commands when using help (#377)
Diffstat (limited to 'examples/05_command_framework')
-rw-r--r--examples/05_command_framework/src/main.rs5
1 files changed, 5 insertions, 0 deletions
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.