From bd4e9f622513c7a632fa0d4087b2e021d6f4dded Mon Sep 17 00:00:00 2001 From: Delyan Angelov Date: Sat, 16 Jul 2022 14:58:26 +0300 Subject: [PATCH] v: offer a suggestion for misspelled commands like `v held` --- cmd/v/v.v | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/cmd/v/v.v b/cmd/v/v.v index cc5630afd..91acfa209 100755 --- a/cmd/v/v.v +++ b/cmd/v/v.v @@ -141,7 +141,15 @@ fn main() { if prefs.is_help { invoke_help_and_exit(args) } - eprintln('v $command: unknown command') + + other_commands := ['run', 'crun', 'build', 'build-module', 'help', 'version', 'new', 'init', + 'install', 'list', 'outdated', 'remove', 'search', 'show', 'update', 'upgrade', 'vlib-docs', + 'interpret', 'translate'] + mut all_commands := []string{} + all_commands << external_tools + all_commands << other_commands + all_commands.sort() + eprintln(util.new_suggestion(command, all_commands).say('v: unknown command `$command`')) eprintln('Run ${term.highlight_command('v help')} for usage.') exit(1) } -- 2.30.2