-ν
Q}σ=c       s    d  Z  D F d e f d     YZ  e d j oQ d k Z  e d e  g  g   Z  e i    e i d  Z  e o  e i	   Z n
  g  Z  e i d  Z
  e
 o  e
 i	   Z
 n
  g  Z
  e i d  Z  e oo  e i d	 e  i   i	   Z  e d e  e e
  Z   e i e  ‘ d
 Ge i GH’ d Ge i   GHn" € d
 Ge i GH₯ d Ge i   GHn d S(   s£	  comand_line class parses command-line switches and returns
   a dictionary containing their values plus the remainder of
   the command line.

   call: comand_line(self, h_switch='', h_string='', lg=[],                      nd=[], ags=sys.argv[1:])

   Parameters of the object can be changed after it is created
   using the methods:
     help_switch(s):
     help_string(s):
     long(l):
     needs(n):
     args(a):
     default(d):

   The help switch, if supplied, is a single character which, if it
   is supplied as a switch, causes the program to exit having
   displayed the help string.

   Switch values are retrieved by calling
   comand_line.switch(self, switch_name, [default]).

   If a switch does not have an explicit value, it is given the value
   '-'.

   If a switch is not supplied, but its value is called for, The default is
   returned, or None if no default is supplied.

   The name of each switch is preceded by '-' and the first item
   that might otherwise be interpreted as a switch marks the end of
   the list of switches.  Single character switches with default values
   can be collected in a single word. The syntax of the list is
   determined by the 'long' and 'needs' list as in the following examples:
     Input       Output         Conditions
     -----       ------         ----------
     -abc        {alpha: None}  abc in long but not needs
     -abc beta   {alpha: beta}  abc in needs
     -abc        {a: None, b: None, c: None}
                                abc in neithr long nor needs
     -abc=beta   {alpha: beta}  long and needs irrelevant. No
                                spaces flanking '='
   Repetions of switches override values assigned to them ealier.

   Called as a program, it can be used to show what would be returned
   under particular circumstances, by supplying suitable value for the
   parameters 'long', 'needs' and 'args'.

   Examples:
     cmd_line.py -a -b -pq foo fie
     flags.avs =  {'a': '-', 'p': '-', 'b': '-', 'q': '-'}
     flags.rest() =  ['foo', 'fie']

     cmd_line.py -args='-a -b -pq foo fie'
     flags.avs =  {'a': '-', 'p': '-', 'b': '-', 'q': '-'}
     rest.rest() =  ['foo', 'fie']

     cmd_line.py -args='-a -b -pq foo fie' -long='pq rs'
     flags.avs =  {'a': '-', 'pq': '-', 'b': '-'}
     rest.rest() =  ['foo', 'fie']

     cmd_line.py -args='-a -b -pq foo fie' -needs='pq rs'
     flags.avs =  {'a': '-', 'pq': 'foo', 'b': '-'}
     rest.rest() =  ['fie']

s   command_linec      sΫ   F H d  k  Z  I d  k Z J d  k Z L e i d  Z N d d g  g  e  i d d  Z X d   Z [ d   Z ^ d   Z	 a d   Z
 d d	   Z g d
   Z j e d  Z  e d  Z  d   Z  d   Z RS(   Ns   \s*=\s*s    i   c    so   N P |  i |  Q |  i |  R |  i |  S |  i |  T |  i	 |  U h  t _ V d t _ d  S(   Ns   -(   s   selfs   help_switchs   h_switchs   help_strings   h_strings   longs   lgs   needss   nds   argss   agss   command_lines   avss   default_value(   s   selfs   h_switchs   h_strings   lgs   nds   ags(    (    s   cmd_line.pys   __init__N s   c    s   X Y | |  _ d  S(   N(   s   ss   selfs   h_switch(   s   selfs   s(    (    s   cmd_line.pys   help_switchX s   c    s   [ \ | |  _ d  S(   N(   s   ss   selfs   h_string(   s   selfs   s(    (    s   cmd_line.pys   help_string[ s   c    s   ^ _ | |  _ d  S(   N(   s   ls   selfs   lg(   s   selfs   l(    (    s   cmd_line.pys   long^ s   c    s   a b | |  _ d  S(   N(   s   ns   selfs   nd(   s   selfs   n(    (    s   cmd_line.pys   needsa s   c    s   d e | |  _ d  S(   N(   s   as   selfs   ags(   s   selfs   a(    (    s   cmd_line.pys   argsd s   c    s   g h | |  _ d  S(   N(   s   ds   selfs   default_value(   s   selfs   d(    (    s   cmd_line.pys   defaultg s   c    sͺ  j k | t j o k |  i } n l xql | o | d d d j oQm | d d | d f \ } } n | o n d } n o |  i i | d  } p t |  } q | d j oΕ r | |  i
 j o% s | d |  i | <t | d } n u | |  i j o v |  i |  i | <n` x xY | Dx ]N } y | |  i j o" z |  i GH{ t i i d  n | |  i |  i | <q$Wn ~ | d |  i | d <q) W | |  _ d  S(   Ni    s   -i   (   s   argss   Nones   selfs   agss   args   eqs   splits   avs   lens   lengths   nds   avss   lgs   default_values   is   h_switchs   h_strings   command_lines   syss   exit(   s   selfs   argss   lengths   avs   is   arg(    (    s   cmd_line.pys   readj s.     ! 
 	c    s<     y  |  i | SWn  t j
 o  | Sn Xd  S(   N(   s   selfs   avss   ss   KeyErrors   default(   s   selfs   ss   default(    (    s   cmd_line.pys   switch s     c    sM     y   |  i | o  d Sn Wn  t j
 o
  n X d Sd  S(   Ni   i    (   s   selfs   avss   ss   KeyError(   s   selfs   s(    (    s   cmd_line.pys   on s   c    s     |  i Sd  S(   N(   s   selfs   ags(   s   self(    (    s   cmd_line.pys   rest s   (   s   syss   strings   res   compiles   eqs   argvs   __init__s   help_switchs   help_strings   longs   needss   argss   defaults   Nones   reads   switchs   ons   rest(    (    (    s   cmd_line.pys   command_lineF s   "
s   __main__Ns   hs   longs   needss   argss   echo s   flags.avs = s   rest.rest() = s   flags.rest() = (   s   __doc__s   objects   command_lines   __name__s   oss   flagss   reads   switchs   longs   splits   needss   argss   popens	   new_flagss   avss   rest(   s   needss   argss   flagss   oss	   new_flagss   command_lines   long(    (    s   cmd_line.pys   ?D s,   J
	
	
"