[mythtv-firehose] mythtv/master commit: a5b368142 by Raymond Wagner (wagnerrp)

MythTV noreply at mythtv.org
Mon Sep 5 07:35:46 UTC 2011


      Author:  Raymond Wagner <rwagner at mythtv.org>
 Change Date:  2011-09-05T00:16:09-07:00
   Push Date:  2011/09/05 00:35:39 -0700
  Repository:  mythtv
      Branch:  master
New Revision:  a5b3681429aa00e92dc0ceef5eac61c0f2845003
   Changeset:  https://github.com/MythTV/mythtv/commit/a5b368142

Log:

Add grouping and sanity checking to command line parser

This constitutes a significant internal rewrite of the parser, however
the existing external interfaces will remain unchanged.  Input data is
now stored as part of the option definition, and option definitions are
now a shared instance of the CommandLineArg class.  Storage for
passthrough data, extra arguments, and undefined options are
re-implemented through instances of this class.

The various add() methods now return a pointer to the newly created
instance, which can be further modified to indicate group membership,
and relationship to other options.

CommandLineArg->SetGroup() specifies which group to display the option
as part of when printing out help text.  Any option not in a group will
be placed in the 'Misc.' group, which is the first group displayed.

There are four types of relationship between arguments: parent, child,
block, and require.  These are set by supplying the name of the option,
or a list of names, to one of the following methods:
    SetParentOf()
    SetChildOf()
    SetRequiredChildOf()
    SetBlocks()
    SetRequires()
Only one side of this relationship needs to be defined, and the parser
will automatically duplicate it in reverse.

Parents require nothing of the child.  The purpose of this relationship
is for the help output.  Child options are not printed independently,
but are indented under each defined parent. Child options require at
least one parent to be specified for them to operate.

Modified:

   mythtv/libs/libmythbase/mythcommandlineparser.cpp
   mythtv/libs/libmythbase/mythcommandlineparser.h
   mythtv/libs/libmythbase/mythversion.h



More information about the mythtv-firehose mailing list