V Qc@s<dZdddYZdZedkr8endS(sHFramework for command line interfaces like CVS. See class CmdFrameWork.tCommandFrameWorkcBs\eZdZdZd ZdZdZd dZdZ dZ d dZ dZ RS( sFramework class for command line interfaces like CVS. The general command line structure is command [flags] subcommand [subflags] [argument] ... There's a class variable GlobalFlags which specifies the global flags options. Subcommands are defined by defining methods named do_. Flags for the subcommand are defined by defining class or instance variables named flags_. If there's no command, method default() is called. The __doc__ strings for the do_ methods are used for the usage message, printed after the general usage message which is the class variable UsageMessage. The class variable PostUsageMessage is printed after all the do_ methods' __doc__ strings. The method's return value can be a suggested exit status. [XXX Need to rewrite this to clarify it.] Common usage is to derive a class, instantiate it, and then call its run() method; by default this takes its arguments from sys.argv[1:]. s;usage: (name)s [flags] subcommand [subflags] [argument] ...tcCsdS(s&Constructor, present for completeness.N((tself((s(/usr/lib64/python2.7/Demo/pdist/cmdfw.pyt__init__#sc Csddl}ddl}|dkr4|jd}ny|j||j\}}Wn |jk ru}|j|SX|j||s|j|j S|d}d|}d|}yt ||} Wn"t k r|jd|fSXyt ||} Wnt k rd} nXy |j|d| \}}Wn.|jk rp}|jd |t |SX|j| ||SdS( s3Process flags, subcommand and options, then run it.iNiitdo_tflags_scommand %r unknownRssubcommand %s: ( tgetopttsystNonetargvt GlobalFlagsterrortusagetoptionstreadytdefaulttgetattrtAttributeErrortstr( RtargsRRtoptstmsgtcmdtmnametfnametmethodtflags((s(/usr/lib64/python2.7/Demo/pdist/cmdfw.pytrun's:            cCsR|rNddGHdGHx+|D]#\}}dG|GdGt|GHqWddGHndS(sWProcess the options retrieved by getopt. Override this if you have any options.t-i(sOptions:toptiontvalueN(trepr(RRtota((s(/usr/lib64/python2.7/Demo/pdist/cmdfw.pyR Gs  cCsdS(s*Called just before calling the subcommand.N((R((s(/usr/lib64/python2.7/Demo/pdist/cmdfw.pyRQscCs$|r|GHn|ji|jjd6GHi}|j}xxut|D]g}|d dkrF|j|rqqFnyt||j}Wn d}nX|r|||su