| OLD | NEW | 
 | (Empty) | 
|    1 # Copyright 2012 Google Inc. All Rights Reserved. |  | 
|    2 # |  | 
|    3 # Licensed under the Apache License, Version 2.0 (the "License"); |  | 
|    4 # you may not use this file except in compliance with the License. |  | 
|    5 # You may obtain a copy of the License at |  | 
|    6 # |  | 
|    7 #     http://www.apache.org/licenses/LICENSE-2.0 |  | 
|    8 # |  | 
|    9 # Unless required by applicable law or agreed to in writing, software |  | 
|   10 # distributed under the License is distributed on an "AS IS" BASIS, |  | 
|   11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |  | 
|   12 # See the License for the specific language governing permissions and |  | 
|   13 # limitations under the License. |  | 
|   14  |  | 
|   15 from gslib.help_provider import HELP_NAME |  | 
|   16 from gslib.help_provider import HELP_NAME_ALIASES |  | 
|   17 from gslib.help_provider import HELP_ONE_LINE_SUMMARY |  | 
|   18 from gslib.help_provider import HelpProvider |  | 
|   19 from gslib.help_provider import HELP_TEXT |  | 
|   20 from gslib.help_provider import HelpType |  | 
|   21 from gslib.help_provider import HELP_TYPE |  | 
|   22  |  | 
|   23 _detailed_help_text = (""" |  | 
|   24 <B>SYNOPSIS</B> |  | 
|   25   Top-level gsutil Options |  | 
|   26  |  | 
|   27  |  | 
|   28 <B>DESCRIPTION</B> |  | 
|   29   gsutil supports separate options for the top-level gsutil command and |  | 
|   30   the individual sub-commands (like cp, rm, etc.) The top-level options |  | 
|   31   control behavior of gsutil that apply across commands. For example, in |  | 
|   32   the command: |  | 
|   33  |  | 
|   34     gsutil -m cp -p file gs://bucket/obj |  | 
|   35  |  | 
|   36   the -m option applies to gsutil, while the -p option applies to the cp |  | 
|   37   sub-command. |  | 
|   38  |  | 
|   39  |  | 
|   40 <B>OPTIONS</B> |  | 
|   41   -d          Shows HTTP requests/headers. |  | 
|   42  |  | 
|   43   -D          Shows HTTP requests/headers plus additional debug info needed when |  | 
|   44               posting support requests. |  | 
|   45  |  | 
|   46   -DD         Shows HTTP requests/headers plus additional debug info plus HTTP |  | 
|   47               upstream payload. |  | 
|   48  |  | 
|   49   -h          Allows you to specify additional HTTP headers, for example: |  | 
|   50  |  | 
|   51                 gsutil -h "Cache-Control:public,max-age=3600" \\ |  | 
|   52                        -h "Content-Type:text/html" cp ... |  | 
|   53  |  | 
|   54               Note that you need to quote the headers/values that |  | 
|   55               contain spaces (such as "Content-Disposition: attachment; |  | 
|   56               filename=filename.ext"), to avoid having the shell split them |  | 
|   57               into separate arguments. |  | 
|   58  |  | 
|   59               Note that because the -h option allows you to specify any HTTP |  | 
|   60               header, it is both powerful and potentially dangerous: |  | 
|   61                 - It is powerful because it allows you to specify headers that |  | 
|   62                   gsutil doesn't currently know about (e.g., to request |  | 
|   63                   service features from a different storage service provider |  | 
|   64                   than Google); or to override the values gsutil would normally |  | 
|   65                   send with different values. |  | 
|   66                 - It is potentially dangerous because you can specify headers |  | 
|   67                   that cause gsutil to send invalid requests, or that in |  | 
|   68                   other ways change the behavior of requests. |  | 
|   69               Thus, you should be sure you understand the underlying storage |  | 
|   70               service HTTP API (and what impact the headers you specify will |  | 
|   71               have) before using the gsutil -h option. |  | 
|   72  |  | 
|   73               See also "gsutil help setmeta" for the ability to set metadata |  | 
|   74               fields on objects after they have been uploaded. |  | 
|   75  |  | 
|   76   -m          Causes supported operations (cp, mv, rm, setacl, setmeta) to run |  | 
|   77               in parallel. This can significantly improve performance if you are |  | 
|   78               uploading, downloading, moving, removing, or changing ACLs on |  | 
|   79               a large number of files over a fast network connection. |  | 
|   80  |  | 
|   81               gsutil performs the specified operation using a combination of |  | 
|   82               multi-threading and multi-processing, using a number of threads |  | 
|   83               and processors determined by the parallel_thread_count and |  | 
|   84               parallel_process_count values set in the boto configuration |  | 
|   85               file. You might want to experiment with these value, as the |  | 
|   86               best value can vary based on a number of factors, including |  | 
|   87               network speed, number of CPUs, and available memory. |  | 
|   88  |  | 
|   89               Using the -m option may make your performance worse if you |  | 
|   90               are using a slower network, such as the typical network speeds |  | 
|   91               offered by non-business home network plans. |  | 
|   92  |  | 
|   93               If a download or upload operation using parallel transfer fails |  | 
|   94               before the entire transfer is complete (e.g. failing after 300 of |  | 
|   95               1000 files have been transferred), you will need to restart the |  | 
|   96               entire transfer. |  | 
|   97  |  | 
|   98   -s          Tells gsutil to use a simulated storage provider (for testing). |  | 
|   99 """) |  | 
|  100  |  | 
|  101  |  | 
|  102 class CommandOptions(HelpProvider): |  | 
|  103   """Additional help about gsutil command-level options.""" |  | 
|  104  |  | 
|  105   help_spec = { |  | 
|  106     # Name of command or auxiliary help info for which this help applies. |  | 
|  107     HELP_NAME : 'options', |  | 
|  108     # List of help name aliases. |  | 
|  109     HELP_NAME_ALIASES : ['arg', 'args', 'cli', 'opt', 'opts'], |  | 
|  110     # Type of help: |  | 
|  111     HELP_TYPE : HelpType.ADDITIONAL_HELP, |  | 
|  112     # One line summary of this help. |  | 
|  113     HELP_ONE_LINE_SUMMARY : 'gsutil-level command line options', |  | 
|  114     # The full help text. |  | 
|  115     HELP_TEXT : _detailed_help_text, |  | 
|  116   } |  | 
| OLD | NEW |