
                  	       8   S r SSKJr  SSKJr  SSKJr  SSKrSSKJr  SSKJ	r	  SSK
Jr  \R                  \R                  " S	S
S9\R                  \R                  " \R                   R"                  5       " S S\R$                  5      5       5       5       5       rg)z&Command to list Cloud Storage objects.    )absolute_import)division)unicode_literalsN)base)	expansion)queueFzBThis command is deprecated. Use `gcloud alpha storage ls` instead.)
is_removedwarningc                   <    \ rS rSrSrSSS.rSr\S 5       rS r	S	r
g
)List   z*List the objects in Cloud Storage buckets.a"        *{command}* lets you list the objects in your Cloud Storage buckets.
      Forward slashes in object names are logically treated as directories for
      the purposes of listing contents. See below for example of how to use
      wildcards to get the listing behavior you want.
      ah        To list the contents of a bucket:

          $ {command} gs://my-bucket

      This will list the direct contents of the bucket. To recursively list the
      contents of all directories in the bucket:

          $ {command} gs://my-bucket --recursive

      You can use wildcards to match multiple paths (including multiple
      buckets). Bucket wildcards are expanded only to the buckets contained in
      your current project:

          $ {command} gs://my-b*/log*.txt

      The following wildcards are valid and match only within the current
      directory:

          *: Matches zero or more characters
          ?: Matches zero or one characters
          []: Matches a character range (ex. [a-z] or [0-9])

      You can use double-star wildcards to match zero or more directory levels
      in a path:

          $ {command} gs://my-bucket/**/log*.txt

      You can also use double-star to match all files after a root in a path:

          $ {command} gs://my-bucket/**

      Double-star expansion can not be combined with other expressions in a
      given path segment and will operate as a single star in that context. For
      example:

          gs://my-bucket/dir**/log.txt      is treated as:

          gs://my-bucket/dir*/log.txt       and instead should be written as:

          gs://my-bucket/dir*/**/log.txt    to get the recursive behavior.
      )DESCRIPTIONEXAMPLESz      table(
          path:label=PATH,
          data.size.size(zero=""):label=SIZE,
          data.timeCreated.date():label=CREATED,
          data.updated.date():label=UPDATED
      )c                     U R                  SSSS9  U R                  SSSS9  U R                  S	SS
S9  U R                  R                  S[        R                  -  5        g )Npath*z{The path of objects and directories to list. The path must begin with gs:// and may or may not contain wildcard characters.)nargshelpz--recursive
store_truezPRecursively list the contents of any directories that match the path expression.)actionr   z--flatten-resultszJShow all matching objects in one list as opposed to grouping by directory.ze        table[no-heading](
            format('{0}:', dir),
            objects:format='%s'
        ))add_argumentdisplay_info	AddFormatr   OBJECT_FORMAT_STRING)parsers    lib/surface/storage/list.pyArgs	List.Argsa   s    
J  K
    !
   
 !! # ((	#) *    c                    UR                   =(       d    S/n[        R                  " 5       nUR                  U5      u  pEUR	                  S5      (       a  UR
                  nOF[        UR                  (       + =(       a%    U=(       a    U(       + =(       a    [        U5      S:  5      n/ nU(       a#  UR                  SUR                  U5      S.5        [        R                  " 5       n[        U5       H  n	UR                  U	5        M     UR                  5       (       d  UR!                  5       n	[        UR#                  U	5      5       V
s/ s H  oU
-   PM	     nn
UR                  U5      nUR                  XS.5        UR                  (       a5  U H/  nUR%                  U5      (       d  M  UR                  US-   5        M1     UR                  5       (       d  M  U(       d  U$ UR'                  5       R)                  [*        R,                  5        [.        R0                  R3                  U Vs/ s H  oS   PM	     sn5      $ s  sn
f s  snf )Nzgs://flatten_results    )dirobjects/r%   )r   r   GCSPathExpanderExpandPathsIsSpecifiedr!   bool	recursivelenappendGetSortedObjectDetailsr   QueuesortedputemptygetListDirIsDirGetDisplayInfor   r   r   	itertoolschainfrom_iterable)selfargspathsexpanderr%   dirsflattenresultsdirs_to_processdochildrendetailscxs                  r   RunList.Runx   s   II"'E((*H((/MG)**$$g
 ' #!*d+#Y]$g
 Gnn55g>@A
 kkmOD\! ##%%



a!'(8(8(;!<=!<Aa%!<h=//9gnnQ34	A^^AC(  ##%% n##D$=$=>??(()H1I,)HII > *Is   I1I N)__name__
__module____qualname____firstlineno____doc__detailed_helpr   staticmethodr   rH   __static_attributes__rJ   r   r   r   r      s;     3
)
1-f * *,,Jr   r   )rO   
__future__r   r   r   r7   googlecloudsdk.callioper   "googlecloudsdk.command_lib.storager   	six.movesr   Hidden	DeprecateUniverseCompatibleReleaseTracksReleaseTrackALPHAListCommandr   rJ   r   r   <module>r^      s     - &  '  ( 8  5 +9 :D%%++,AJ4 AJ - : 
AJr   