
                             d Z ddlmZmZ ddlZddlmZ dZdZdZ	dZ
d	Zd
ZdZdZdZdZdZdZdZdZedz  ZeZddeeef   fdZd Zd Zd Zy)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                 |    t        j                  | d      } | syi }t        | j                        }|r	||t        <   |S )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    (   sD     !!,5,	-	11	2$	#M)	    c                    g }| j                   D ]  }|j                  rt        g i}|j                  r	d|t        <   |j
                  r	d|t        <   |j                  r	d|t        <   t        t        j                               |t        <   t        |      |t        <   |t           s|j                  t        |i       |j                   r|j                  t#        |             |j                  t%        |              |S )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                     | j                   }|j                  t              rt        }n|j                  t              rt        }nd}|t	        |      d }|j                  t        t              }t        |i}| j                  |t        <   | j                  |t        <   | j                  r	d|t        <   | j                  rt!        | j                        |t"        <   t%        t'        j(                               |t*        <   |S )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                    | j                   j                  t        t              j	                         }t
        |t        di}| j                  t        v}|r	||t        <   t        t        j                               |t        <   |S )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   sl     OO++FJ?EEG/?J=/ #((> 3OH ./'	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!   