
                             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mZ ddl	m
Z
 ddl	mZ dd	l	mZ dd
lmZ  G d de
j                        Z G d dej"                        Zy)zCommand to list properties.    )absolute_import)division)unicode_literals)base)
completers)
exceptions)log)
properties)named_configsc                       e Zd ZdZy)BadConfigListInvocationz5Exception for incorrect invocations of `config list`.N)__name__
__module____qualname____doc__     lib/surface/config/list.pyr   r      s    =r   r   c                   j    e Zd ZdZdej
                  j                         iZed        Z	d Z
d Zd Zy)Lista  List Google Cloud CLI properties for the currently active configuration.

  {command} lists the properties of the specified section using the
  active configuration. These include the account used to authorize access to
  Google Cloud, the current Google Cloud project, and the default Compute Engine
  region and zone, if set. See `gcloud topic configurations` for more about
  configurations.

  ## AVAILABLE PROPERTIES

  {properties}

  ## EXAMPLES

  To list the set project property in the core section, run:

    $ {command} project

  To list the set zone property in the compute section, run:

    $ {command} compute/zone

  To list all the set properties in the compute section, run:

  $ {command} compute/

  To list all the properties in the compute section, run:

  $ {command} compute/ --all

  To list all the properties, run:

    $ {command} --all

  Note, you cannot specify both `--all` and a property name. Only a section name
  and the `--all` flag can be used together in the format `gcloud config list
  <SECTION>/ --all`.
  r
   c                 \   | j                  ddd       | j                  dddt        j                  d	       t        j                  j                  |        t        j                  j                  |        | j                  j                  d
       | j                  j                  d       y)zAdds args for this command.z--all
store_truez;List all set and unset properties that match the arguments.)actionhelppropertyzSECTION/PROPERTY?zhProperty to be listed. Note that SECTION/ is optional while referring to properties in the core section.)metavarnargs	completerr   configN)
add_argumentr   PropertiesCompleterr   PAGE_SIZE_FLAGRemoveFromParserURI_FLAGdisplay_info	AddFormatAddCacheUpdater)parsers    r   Argsz	List.ArgsK   s     J  L "007  8 	((0MM""6*
!!(+
''-r   c                    t        j                  |j                        \  }}|r@||t         j                  j	                  |      j                  |      j                         iiS |r;|t         j                  j	                  |      j                  |j                        iS t         j                  j                  |j                        S )z"List available regular properties.)
list_unset)	r
   ParsePropertyStringr   VALUESSectionPropertyGet	AllValuesall)selfargssectionprops       r   _GetPropertiesToDisplayzList._GetPropertiesToDisplay^   s    224==AMGT
J%%--g6??EIIK 
 
''0::dhh:O  &&$((&;;r   c                     t        j                  |j                        \  }}|j                  r|rt	        d      | j                  |      S )NzrCommands with the `--all` flag must be in the format `gcloud config list <SECTION>/` without a property specified.)r
   r-   r   r3   r   r8   )r4   r5   _r7   s       r   RunzList.Runo   sK    ,,T]];GAtxxD#BC C ''--r   c                     t         j                  j                         j                  }t        j
                  j                  dj                  |             y )Nz%
Your active configuration is: [{0}]
)r   ConfigurationStoreActiveConfignamer	   statuswriteformat)r4   resources_were_displayedconfig_names      r   EpilogzList.Epilogw   s=    22??AFFKJJ188EGr   N)r   r   r   r   r
   r.   GetHelpStringdetailed_helpstaticmethodr*   r8   r;   rE   r   r   r   r   r   !   sE    %N  !2!2!@!@!BC-. .$<".Gr   r   N)r   
__future__r   r   r   googlecloudsdk.callioper   !googlecloudsdk.command_lib.configr   googlecloudsdk.corer   r	   r
   "googlecloudsdk.core.configurationsr   Errorr   ListCommandr   r   r   r   <module>rP      sM    " &  ' ( 8 * # * <>j.. >YG4 YGr   