[ovs-dev] [PATCH] command-line: Add function to print all options.

Alex Wang alexw at nicira.com
Thu Oct 16 21:50:40 UTC 2014


Sorry for the confusion, I mean:

`command --help (or -h)` still prints out the usage page,

`command help` prints the function format (usage).

What do you think?

Thanks,
Alex Wang,


On Thu, Oct 16, 2014 at 2:41 PM, Ben Pfaff <blp at nicira.com> wrote:

> On Wed, Oct 15, 2014 at 09:51:54AM -0700, Alex Wang wrote:
> > I'm changing the 'struct command' like this:
> >
> > diff --git a/lib/command-line.h b/lib/command-line.h
> > index 157cb58..57fdff5 100644
> > --- a/lib/command-line.h
> > +++ b/lib/command-line.h
> > @@ -27,7 +27,7 @@ struct command {
> >      const char *name;
> > +    const char *usage;
> >      int min_args;
> >      int max_args;
> > -    void (*handler)(int argc, char *argv[]);
> > +    void (*handler)(int argc, char *argv[], void *aux);
> >  };
> >
> > The 'usage' will record the format of cmds. (e.g. the 'usage' in 'struct
> > unixctl_command').  The 'help' subcommand will print the command with
> > usage and bash completion script will parse it.
> >
> > The 'handler()' change is for eliminating the 'struct dpctl_command'.
> >
> > I saw this will affect a ton of cmd source files e.g. ovsdb-tool,
> > ovs-benchmark
> > which uses 'struct command'.
> >
> > So, want to know what you think about doing this.
>
> I think it could be a nice step forward but I worry that it will make
> the --help output harder to read.
>



More information about the dev mailing list