File: //lib/python2.7/site-packages/leapp/utils/clicmd.pyc
�
g��fc @ s d d l Z d d l Z d d l Z d d l m Z m Z m Z d d l Z d d l m Z m
Z
m Z m Z d e f d � � YZ
d e f d � � YZ d e f d � � YZ d
e f d � � YZ d d d d
� Z d � Z d d d � Z d � Z d � Z d S( i����N( t ArgumentParsert RawDescriptionHelpFormattert _SubParsersAction( t CommandDefinitionErrort CommandErrort UnknownCommandErrort
UsageErrort _LeappArgumentParserc B s e Z d � Z d � Z RS( c C s t t | � j d t j � d S( Nt file( t superR t
print_helpt syst stderr( t self( ( s6 /usr/lib/python2.7/site-packages/leapp/utils/clicmd.pyR
s c C s/ | j � t j j d | � t j d � d S( Ns
error: %s
i ( R
R R t writet exit( R
t message( ( s6 /usr/lib/python2.7/site-packages/leapp/utils/clicmd.pyt error s
( t __name__t
__module__R
R ( ( ( s6 /usr/lib/python2.7/site-packages/leapp/utils/clicmd.pyR s t _LeappHelpFormatterc B s e Z d Z d � Z RS( s9
Capitalizes section headings in the help output
c C s t t | � j | j � � S( N( R R t
start_sectiont
capitalize( R
t heading( ( s6 /usr/lib/python2.7/site-packages/leapp/utils/clicmd.pyR s ( R R t __doc__R ( ( ( s6 /usr/lib/python2.7/site-packages/leapp/utils/clicmd.pyR s t _SubParserActionOverridec B s e Z d Z d d � Z RS( s�
This class implements a workaround for an issue fixed in 2.7.9.
See https://bugs.python.org/issue9351
TL;DR: Before, 2.7.9 argparse._SubParserAction did not propagate sub parser default values
to the global namespace when they were already defined .
This implementation is a workaround to override those values additionally.
The additional code will not be executed if python 2.7.9 or higher is found.
c
C s� t t | � j | | | | � t j d k r2 d S| d } | d } | j | } | j | d � \ } } x0 t | � j � D] \ } } t
| | | � q~ Wd S( Ni i i i i ( i i i ( R R t __call__R t version_infot _name_parser_mapt parse_known_argst Nonet varst itemst setattr(
R
t parsert namespacet valuest
option_stringt parser_namet arg_stringst
sub_namespacet keyt value( ( s6 /usr/lib/python2.7/site-packages/leapp/utils/clicmd.pyR + s
N( R R R R R ( ( ( s6 /usr/lib/python2.7/site-packages/leapp/utils/clicmd.pyR s
t Commandc B s� e Z d Z d d d d � Z d � Z d � Z d � Z d d d � Z d � Z d � Z
d � Z d d e e e
d d d d d d
�
Z d d d d � Z RS(
sW
Command implements a convenient command-based argument parsing the framework.
t c C sR | | _ | | _ | p | | _ i | _ g | _ | | _ d | _ d | _ d S( si
:param name: Name of the sub command
:type name: str
:param target: Function called when the command is invoked
:type target: Callable
:param help: Shows a help message
:type help: str
:param description: Extended description of the command (the default is `help`)
:type description: str
N( t namet helpt descriptiont
_sub_commandst _optionst targetR t parentR"