
                             S r SSKJr  SSKJr  SSKJr  SSKJr  SSKrSSKrSSKJ	r	  SSK
Jr  SS	KJr  SS
KJr  SSKJr  SSKJr  SSKJr  SSKJr  \R,                  (       a  \rSrS\-   S-   r " S S\	5      rg)zDImplementation of Unix-like cat command for cloud storage providers.    )absolute_import)print_function)division)unicode_literalsN)Command)CommandArgument)ApiSelector)CommandException)
cat_helper)	constants)GcloudStorageFlag)GcloudStorageMapz
  gsutil cat [-h] url...
z
<B>SYNOPSIS</B>
aJ  


<B>DESCRIPTION</B>
  The cat command outputs the contents of one or more URLs to stdout.
  While the cat command does not compute a checksum, it is otherwise
  equivalent to doing:

    gsutil cp url... -

  (The final '-' causes gsutil to stream the output to stdout.)

  WARNING: The gsutil cat command does not compute a checksum of the
  downloaded data. Therefore, we recommend that users either perform
  their own validation of the output of gsutil cat or use gsutil cp
  or rsync (both of which perform integrity checking automatically).


<B>OPTIONS</B>
  -h          Prints short header for each object. For example:

                gsutil cat -h gs://bucket/meeting_notes/2012_Feb/*.txt

              This would print a header with the object name before the contents
              of each text object that matched the wildcard.

  -r range    Causes gsutil to output just the specified byte range of the
              object. Ranges can be of these forms:

                start-end (e.g., -r 256-5939)
                start-    (e.g., -r 256-)
                -numbytes (e.g., -r -5)

              where offsets start at 0, start-end means to return bytes start
              through end (inclusive), start- means to return bytes start
              through the end of the object, and -numbytes means to return the
              last numbytes of the object. For example:

                gsutil cat -r 256-939 gs://bucket/object

              returns bytes 256 through 939, while:

                gsutil cat -r -5 gs://bucket/object

              returns the final 5 bytes of the object.
c                   "   \ rS rSrSr\R                  " S/ \S\R                  SSSS\
R                  \
R                  /\
R                  \R                  " 5       /S9r\R                   " S/ S	S
\0 S9r\" SS/\" S5      \" S5      S.S9rS rSrg)
CatCommand]   z%Implementation of gsutil cat command.cat   zhr:Fr   )command_name_aliasesusage_synopsismin_argsmax_argssupported_sub_argsfile_url_okprovider_url_okurls_start_arggs_api_supportgs_default_apiargparse_argumentscommand_helpz$Concatenate object content to stdout)	help_namehelp_name_aliases	help_typehelp_one_line_summary	help_textsubcommand_help_textstoragez-d-r)-hr'   )gcloud_commandflag_mapc                    SnSnSnSnU R                   (       Ga  U R                    GH  u  pVUS:X  a  SnM  US:X  a  UR                  5       nUS:X  a  M.  [        R                  " S5      nUR	                  U5      nU(       d  [        S	U-  5      eUR                  S
5      (       a  [        UR                  S
5      5      nUR                  S5      (       a  [        UR                  S5      5      nUR                  S5      (       a  [        UR                  S5      5      nM  M  U R                  5         GM     [        R                  " U 5      R                  U R                  UUUS9$ )z(Command entry point for the cat command.FNr   r(   Tr'   -z;^(?P<start>[0-9]+)-(?P<end>[0-9]*)$|^(?P<endslice>-[0-9]+)$zInvalid range (%s)startendendslice)show_header
start_byteend_byte)sub_optsstriprecompilematchr
   grouplongRaiseInvalidArgumentExceptionr   	CatHelperCatUrlStringsargs)	selfr0   request_ranger1   r2   oarange_matcherrange_matchs	            %platform/gsutil/gslib/commands/cat.py
RunCommandCatCommand.RunCommand   sK   KMJH}}}--$!9+$Y'')- c!**KM-%++M:+"#7-#GHHw''k//89Ju%%K--e45Hz**k//
;<J + 
,
,
.+  . %33DII@K?I=E 4 G G     N)__name__
__module____qualname____firstlineno____doc__r   CreateCommandSpec	_SYNOPSISr   NO_MAXr	   XMLJSONr   MakeZeroOrMoreCloudURLsArgumentcommand_specHelpSpec_DETAILED_HELP_TEXT	help_specr   r   gcloud_storage_maprE   __static_attributes__rH   rG   rD   r   r   ]   s    - **!oo{'7'78 %%)IIKLN, B#) ('!$'!$'!GrG   r   )rM   
__future__r   r   r   r   r5   sixgslib.commandr   gslib.command_argumentr   gslib.cs_api_mapr	   gslib.exceptionr
   gslib.utilsr   r   gslib.utils.shim_utilr   r   PY3intr9   rO   rV   r   rH   rG   rD   <module>rd      ss     K & %  ' 	 
 ! 2 ( , " ! 3 277	$	-/ dEG EGrG   