Author paul.j3
Recipients John.Didion, bethard, manveru, paul.j3, xuanji
Date 2014-02-15.07:11:01
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
Regarding a usage line like:

    (-o FILE | (-O DIR & (-p PATTERN | -s SUFFIX))

The simplest option is to just a custom written 'usage' parameter.

With the existing HelpFormatter, a nested grouping like this is next to impossible.  It formats the arguments (e.g.'-O DIR'), interleaves the group symbols, and then trims out the excess spaces and symbols.  is a request to allow overlapping mutually_exclusive_groups.  It loops on the groups, formatting each.  It would be easier with that to format several different types of groups, and to handle nested ones.

What would it take to convert a usage string like that into a logical expression that tests for the proper occurrence (or non-occurrence) of the various arguments.  It might, for example be converted to

    exc(file, inc(dir, exc(pattern, suffix)))

where 'exc' and 'inc' are exclusive and inclusive tests, and 'file','dir' etc are booleans.  And what would be the error message(s) if this expression fails?

I can imagine a factory function that would take usage line (or other expression of groupings), and produce a function that would implement a cross_test (as outlined in my previous post).  It would be, in effect, a micro-language compiler.
Date User Action Args
2014-02-15 07:11:02paul.j3setrecipients: + paul.j3, bethard, xuanji, John.Didion, manveru
2014-02-15 07:11:02paul.j3setmessageid: <>
2014-02-15 07:11:02paul.j3linkissue11588 messages
2014-02-15 07:11:01paul.j3create