Your IP : 3.147.238.179


Current Path : /lib64/python2.7/Demo/pdist/
Upload File :
Current File : //lib64/python2.7/Demo/pdist/cmdfw.pyc

�
V
�Qc@s<dZddd��YZd�Zedkr8e�ndS(sHFramework for command line interfaces like CVS.  See class CmdFrameWork.tCommandFrameWorkcBs\eZdZdZd	ZdZd�Zd	d�Zd�Z	d�Z
d	d�Zd�ZRS(
s�Framework 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_<subcommand>.  Flags for the subcommand are
    defined by defining class or instance variables named
    flags_<subcommand>.  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__#scCs�ddl}ddl}|dkr4|jd}ny|j||j�\}}Wn |jk
ru}|j|�SX|j|�|s�|j�|j	�S|d}d|}d|}yt
||�}	Wn"tk
r�|jd|f�SXyt
||�}
Wntk
rd}
nXy |j|d|
�\}}Wn.|jk
rp}|jd	|t|��SX|j�|	||�SdS(
s3Process flags, subcommand and options, then run it.i����Niitdo_tflags_scommand %r unknownRssubcommand %s: (
tgetopttsystNonetargvtGlobalFlagsterrortusagetoptionstreadytdefaulttgetattrtAttributeErrortstr(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}x�xut|�D]g}|d dkrF|j|�rqqFnyt||�j}Wn
d}nX|r�|||<q�qFqFW|js�Pn|jd}q9|rdGH|j	�}|j
�x|D]}||GHq�Wn|jr |jGHndS(s4Print usage message.  Return suitable exit code (2).tnameiRiswhere subcommand can be:iN(tUsageMessaget	__class__t__name__tdirthas_keyRt__doc__Rt	__bases__tkeystsorttPostUsageMessage(RRt
docstringstcR"tdoctnames((s(/usr/lib64/python2.7/Demo/pdist/cmdfw.pyRUs8	
	

	cCs	dGHdS(s\Default method, called when no subcommand is given.
        You should always override this.s'Nobody expects the Spanish Inquisition!N((R((s(/usr/lib64/python2.7/Demo/pdist/cmdfw.pyRssN(
R%t
__module__R(R#RR,R
RRR
RRR(((s(/usr/lib64/python2.7/Demo/pdist/cmdfw.pyRs	 	
	cCs�ddl}dtfd��Y}|�}gdgdgdgddgdg}x9|D]1}dG|GdGH|j|�}d
Gt|�GHqYWdS(
s:Test script -- called when this module is run as a script.i����NtHellocBseZd�ZRS(cSs	dGHdS(s0hello -- print 'hello world', needs no argumentssHello, worldN((RRR((s(/usr/lib64/python2.7/Demo/pdist/cmdfw.pytdo_hello}s(R%R1R3(((s(/usr/lib64/python2.7/Demo/pdist/cmdfw.pyR2|sthellotspams-xRi
sExit status:s
----------s
----------(RRRRR(RR2txtteststttsts((s(/usr/lib64/python2.7/Demo/pdist/cmdfw.pyttestys			

t__main__N((R(RR:R%(((s(/usr/lib64/python2.7/Demo/pdist/cmdfw.pyt<module>su