[PATCH] PR driver/69265: add hint for options with misspelled arguments

2016-05-09 Thread David Malcolm
opts-common.c's cmdline_handle_error handles invalid arguments for options with CL_ERR_ENUM_ARG by building a strings listing the valid arguments. By also building a vec of valid arguments, we can use find_closest_string and provide a hint if we see a close misspelling. Successfully bootstrapped®

Re: [PATCH] PR driver/69265: add hint for options with misspelled arguments

2016-05-18 Thread Jeff Law
On 05/09/2016 06:14 PM, David Malcolm wrote: opts-common.c's cmdline_handle_error handles invalid arguments for options with CL_ERR_ENUM_ARG by building a strings listing the valid arguments. By also building a vec of valid arguments, we can use find_closest_string and provide a hint if we see a

Re: [PATCH] PR driver/69265: add hint for options with misspelled arguments

2016-05-10 Thread Bernhard Reutner-Fischer
On Mon, May 09, 2016 at 08:14:47PM -0400, David Malcolm wrote: > - inform (loc, "valid arguments to %qs are: %s", option->opt_text, s); > + const char *hint = find_closest_string (arg, &candidates); > + if (hint) > + inform (loc, "valid arguments to %qs are: %s; did you mean %qs

Re: [PATCH] PR driver/69265: add hint for options with misspelled arguments

2016-05-10 Thread David Malcolm
On Tue, 2016-05-10 at 22:09 +0200, Bernhard Reutner-Fischer wrote: > On Mon, May 09, 2016 at 08:14:47PM -0400, David Malcolm wrote: > > > - inform (loc, "valid arguments to %qs are: %s", option > > ->opt_text, s); > > + const char *hint = find_closest_string (arg, &candidates); > > +

Re: [PATCH] PR driver/69265: add hint for options with misspelled arguments

2016-05-10 Thread Manuel López-Ibáñez
On 10/05/16 22:03, David Malcolm wrote: On Tue, 2016-05-10@22:09 +0200, Bernhard Reutner-Fischer wrote: On Mon, May 09, 2016@08:14:47PM -0400, David Malcolm wrote: - inform (loc, "valid arguments to %qs are: %s", option ->opt_text, s); + const char *hint = find_closest_string (arg, &