X-Git-Url: https://git.kernel.dk/?p=fio.git;a=blobdiff_plain;f=parse.c;h=ad2b1e3c76cf9a3691a7466598de6823b8064b20;hp=785d5699857963bcc48ee65db160b7cb4336f0e2;hb=aa58d2520204f5ae12291fae0289a90fb03dc587;hpb=7758d4f0b0f87d53826e1a6a6302bdc16667ed2d diff --git a/parse.c b/parse.c index 785d5699..ad2b1e3c 100644 --- a/parse.c +++ b/parse.c @@ -837,7 +837,7 @@ static void print_option(struct fio_option *o) int show_cmd_help(struct fio_option *options, const char *name) { struct fio_option *o, *closest; - unsigned int best_dist; + unsigned int best_dist = -1U; int found = 0; int show_all = 0; @@ -890,7 +890,12 @@ int show_cmd_help(struct fio_option *options, const char *name) return 0; printf("No such command: %s", name); - if (closest) { + + /* + * Only print an appropriately close option, one where the edit + * distance isn't too big. Otherwise we get crazy matches. + */ + if (closest && best_dist < 3) { printf(" - showing closest match\n"); printf("%20s: %s\n", closest->name, closest->help); show_option_help(closest, stdout);