On Thu, May 01, 2008, Jeff Johnson wrote:

> While using popt in another program, I came across 2 usage
> cases that might be usefully internalized in popt.
>
> One usage case was an attempt to specify a memory limit as
>     --memory 16777216
> Adding unit scaling, e.g.
>     --memory 16Mb
>     --memory 16384Kb
> would not be hard to add using something like
>     POPT_ARG_INT | POPT_ARGFLAG_UNITS
> with the usual Kb/Kib Mb/Mib Gb/Gib tokens to prescale.
>
> Another possible popt-1.15 usage case is getdate.y, which is wonderfully
> useful for time/date argument input. While it is
> rather easy to use getdate.y through a popt callback, perhaps
> its time to push getdate.y into libpopt, and add a
>     POPT_ARG_DATE
> distinguished method to make it as easy as possible to use getdate.y.
>
> I'm also seeing a need for a KEY=VALUE comma separated list popt
> sub-table option parser (there's a mouthful ;-)
>
> I'm starting to see
>     --option K1=V1,K2=V2,K3=V3
> occurrences more often. I can think of a couple ways to use popt
> to recursively parse KEY=VALUE settings, either by keeping track
> of a chained popt table that is used iff a specific --option is
> encountered,
> or by overloading the pointer field to be used as a option specific
> subtable parse.
>
> Opinions?

The --option K1=V1,K2=V2,K3=V3 is generic and would be very useful IMHO.

But the unit and date parsing is something I think should be perhaps
still better done in the application (or the POPT callback) because
where is the end of this story? If POPT provides units and dates,
someone else comes and wants URL arguments pre-parsed into its parts,
that user/group names are converted to user ids and vice versa, that
chmod(8) strings are converted to octals and vice versa, etc. Either
POPT would have to provide a really large set of those conversions are
better none at all. Additionally, if POPT provides those conversions it
perhaps better should be at least placed into a POPT sub-library so that
one still can have a rather small plain POPT library and if required and
wished one can link against the additional POPT "utility" library for
addon functionalities like those conversions...

                                       Ralf S. Engelschall
                                       [EMAIL PROTECTED]
                                       www.engelschall.com

______________________________________________________________________
POPT Library                                           http://rpm5.org
Developer Communication List                       popt-devel@rpm5.org

Reply via email to