
                             S r SSKJrJr  SSKrSSKJr  SrSrSr	Sr
S	rS
rSrSrSrSrSrSrSrSr\S-  r\rSS\\\4   4S jjrS rS rS rg)zKLibrary for generating argument specifications for current implementations.    )AnyDictN)cli_treemutexhiddennamenode_id	argumentsrequiredgrouptypechoices
positional)r   ?*z...global_-   returnc                     [         R                  " U S5      n U (       d  g0 n[        U R                  5      nU(       a  X![        '   U$ )zGenerates the argument specifications for the calliope cli command node.

Args:
  command_node: calliope command node cli object.

Returns:
  The argument specifications for the command node.
N)r   Command_AddArgsToGroupconstraints	ARGUMENTS)command_nodeargument_treeargss      =lib/googlecloudsdk/command_lib/meta/generate_argument_spec.pyGenerateArgumentSpecificationsr    (   sB     !!,5,	-	11	2$	#)	    c                 P   / nU R                    GH  nUR                  (       a  [        / 0nUR                  (       a	  SU[        '   UR
                  (       a	  SU[        '   UR                  (       a	  SU[        '   [        [        R                  " 5       5      U[        '   [        U5      U[        '   U[           (       a  UR                  [        U05        M  M  UR                   (       a  UR                  [#        U5      5        M  UR                  [%        U5      5        GM     U$ )zAdd the given arguments to the given arguments group spec.

Args:
  arguments: iterable: calliope objects representing the arguments group.

Returns:
  The list of arguments added to the group spec.
T)r
   is_groupr   is_mutexMUTEXis_requiredREQUIRED	is_hiddenHIDDENstruuiduuid4NODE_IDr   appendGROUPis_positional_GetPositionalSpec_GetFlagSpec)r
   args_group_specargchild_args_group_specs       r   r   r   ;   s     /  c
||("o	'+e$	*.h'	(,f%'*4::<'8G$)8)=I&	y	)'<=> 
*			/45\#./# !$ 
r!   c                 *   U R                   nUR                  [        5      (       a  [        nO#UR                  [        5      (       a  [        nOSnU[	        U5      S nUR                  [        [        5      n[        U0nU R                  U[        '   U R                  U[        '   U R                  (       a	  SU[        '   U R                  (       a  [!        U R                  5      U["        '   [%        [&        R(                  " 5       5      U[*        '   U$ )zGet the flag spec for the given flag.

Args:
  flag: The calliope object representing the flag.

Returns:
  The flag spec for the given flag.
 NT)r   
startswithFLAG_PREFIXSHORT_FLAG_PREFIXlenreplace
UNDERSCOREHYPHENNAMEr   TYPEr&   r'   	is_globalGLOBALr   listCHOICESr*   r+   r,   r-   )flag	flag_nameflag_prefix	flag_specs       r   r2   r2   Z   s     ii)+&&K-..#KKK(*+)
F3)Y)II)D/(()H	^^If	\\dll+Ig4::<()G	r!   c                    U R                   R                  [        [        5      R	                  5       n[
        U[        S0nU R                  [        ;  nU(       a  X2[        '   [        [        R                  " 5       5      U[        '   U$ )zGet the positional spec for the given positional.

Args:
  positional: The calliope object representing the positional.

Returns:
  The positional spec for the given positional.
T)r   r<   r>   r=   upperr?   
POSITIONALnargsOPTIONAL_NARGSr'   r*   r+   r,   r-   )r   positional_namepositional_specpositional_requireds       r   r1   r1   y   sj     OO++FJ?EEG/?J=/ #((> 3H ./'	r!   )N)__doc__typingr   r   r+   googlecloudsdk.callioper   r%   r)   r?   r-   r   r'   r/   r@   rD   rK   rM   rB   r=   r>   r9   r:   r*   r    r   r2   r1    r!   r   <module>rU      s    R   ,	
	

%	
	qj c3h &>>r!   