
                             d Z ddlmZ ddlmZ ddlmZ ddlmZ ddlZddlmZ dd	gZ	d
Z
dZde
z
  ZdZdZ G d de      Zd Zd Zy)z=Module defining help types and providers for gsutil commands.    )absolute_import)print_function)division)unicode_literalsN)CommandExceptioncommand_helpadditional_help   
   P   z
<B>DESCRIPTION</B>z
<B>SYNOPSIS</B>c                   >    e Zd ZdZ ej
                  dg d      ZdZy)HelpProviderzInterface for providing help.HelpSpec)	help_namehelp_name_aliases	help_typehelp_one_line_summary	help_textsubcommand_help_textN)__name__
__module____qualname____doc__collections
namedtupler   	help_spec     &platform/gsutil/gslib/help_provider.pyr   r   (   s(    % $[##	($ )r   r   c           
         t        | j                  j                        }|dkD  r	|t        k  s0J dj	                  | j                  j                  t                     | j                  j
                  D ]  }|rJ  t        | j                  j                        }|t        k\  s1J dj	                  | j                  j                  |t                     |t        k  s1J dj	                  | j                  j                  |t                     t        | j                  j                        dkD  s+J d	j	                  | j                  j                  
             | j                  j                  g}|j                  | j                  j
                         |D ]1  }||v st        d|d| j                  d||   j                         y)zGHelper for checking that a HelpProvider has minimally adequate content.   z.The help name "{text}" must be less then {max})textmaxzZThe one line summary "{text}" with a length of {length} must be more then {min} characters)r"   lengthminzZThe one line summary "{text}" with a length of {length} must be less then {max} characters)r"   r$   r#   r   z+The length of "{text}" must be less then 10)r"   zDuplicate help name/alias "z " found while loading help from z'. That name/alias was already taken by N)lenr   r   MAX_HELP_NAME_LENformatr   r   MIN_ONE_LINE_SUMMARY_LENMAX_ONE_LINE_SUMMARY_LENr   extendr   r   )help_providerhelp_name_maphelp_name_lenhnaone_line_summary_lenname_check_listname_or_aliass          r   SanityCheckr3   D   s    m--778-
!
0A A L<CC))339J D LL
A $$66cJ3 7]44JJK
":
: (#$*F&&<<%& %+ %((
: ":
: (#$*F&&<<%& %+ %((
: 
]$$.. 

 8AHH",,66 I 88 

 #,,667/00BBC&m% -22'2245 5 'r   c                 (    t         | z   t        z   |z   S )zCHelper for adding help text headers given synopsis and description.)SYNOPSIS_PREFIXDESCRIPTION_PREFIX)synopsisdescriptions     r   CreateHelpTextr9   j   s    	8	#&8	8;	FFr   )r   
__future__r   r   r   r   r   gslib.exceptionr   ALL_HELP_TYPESr'   r)   r*   r6   r5   objectr   r3   r9   r   r   r   <module>r>      si    D & %  '  , "34    11  6 8#5LGr   