[PATCH v3 3/9] argparse: allow user-override of help printing

Bruce Richardson bruce.richardson at intel.com
Mon Jul 21 11:00:21 CEST 2025


On Mon, Jul 21, 2025 at 10:43:05AM +0200, David Marchand wrote:
> On Fri, Jul 18, 2025 at 4:34 PM Bruce Richardson
> <bruce.richardson at intel.com> wrote:
> > diff --git a/lib/argparse/rte_argparse.c b/lib/argparse/rte_argparse.c
> > index d3b32c6357..e7b9bf573d 100644
> > --- a/lib/argparse/rte_argparse.c
> > +++ b/lib/argparse/rte_argparse.c
> > @@ -821,7 +821,10 @@ rte_argparse_parse(const struct rte_argparse *obj, int argc, char **argv)
> >                 goto error;
> >
> >         if (show_help) {
> > -               rte_argparse_print_help(stdout, obj);
> > +               if (obj->print_help != NULL)
> > +                       obj->print_help(obj);
> 
> Should we pass a stream to the callback?
> 
I briefly thought about it, but I don't see the point. The callback can
print to stdout by default if it wants anyway, or stderr (or any other file
handle) if preferred by the user. Adding a filehandle would make the calls
consistent, but not any actual value.

/Bruce


More information about the dev mailing list