Help string format persistent

Keep the format of these strings constant through all options and commands.

Change-Id: I67a47bdd5681b4b221baf55933a175568aa8e16d
This commit is contained in:
Luis de Bethencourt 2014-02-26 15:52:07 -05:00
parent f2cd140ccd
commit 25a0e63619
1 changed files with 54 additions and 50 deletions

104
bin/swift
View File

@ -79,13 +79,13 @@ st_delete_help = '''
Delete a container or objects within a container Delete a container or objects within a container
Positional arguments: Positional arguments:
<container> Name of container to delete from <container> Name of container to delete from.
[object] Name of object to delete. Specify multiple times [object] Name of object to delete. Specify multiple times
for multiple objects for multiple objects.
Optional arguments: Optional arguments:
--all Delete all containers and objects --all Delete all containers and objects.
--leave-segments Do not delete segments of manifest objects --leave-segments Do not delete segments of manifest objects.
--object-threads <threads> --object-threads <threads>
Number of threads to use for deleting objects. Number of threads to use for deleting objects.
Default is 10 Default is 10
@ -255,14 +255,14 @@ Positional arguments:
objects from the container. objects from the container.
Optional arguments: Optional arguments:
--all Indicates that you really want to download --all Indicates that you really want to download everything
everything in the account in the account.
--marker Marker to use when starting a container or account --marker Marker to use when starting a container or account
download download.
--prefix <prefix> Only download items beginning with <prefix> --prefix <prefix> Only download items beginning with <prefix>.
--output <out_file> For a single file download, stream the output to --output <out_file> For a single file download, stream the output to
<out_file>. Specifying "-" as <out_file> will <out_file>. Specifying "-" as <out_file> will
redirect to stdout redirect to stdout.
--object-threads <threads> --object-threads <threads>
Number of threads to use for downloading objects. Number of threads to use for downloading objects.
Default is 10 Default is 10
@ -270,12 +270,13 @@ Optional arguments:
Number of threads to use for downloading containers. Number of threads to use for downloading containers.
Default is 10 Default is 10
--no-download Perform download(s), but don't actually write anything --no-download Perform download(s), but don't actually write anything
to disk to disk.
--header <header_name:header_value> --header <header_name:header_value>
Adds a customized request header to the query, like Adds a customized request header to the query, like
"Range" or "If-Match". This argument is repeatable. "Range" or "If-Match". This argument is repeatable.
Example --header "content-type:text/plain" Example --header "content-type:text/plain"
--skip-identical Skip downloading files that are identical on both sides --skip-identical Skip downloading files that are identical on both
sides.
'''.strip("\n") '''.strip("\n")
@ -283,11 +284,11 @@ def st_download(parser, args, thread_manager):
parser.add_option( parser.add_option(
'-a', '--all', action='store_true', dest='yes_all', '-a', '--all', action='store_true', dest='yes_all',
default=False, help='Indicates that you really want to download ' default=False, help='Indicates that you really want to download '
'everything in the account') 'everything in the account.')
parser.add_option( parser.add_option(
'-m', '--marker', dest='marker', '-m', '--marker', dest='marker',
default='', help='Marker to use when starting a container or ' default='', help='Marker to use when starting a container or '
'account download') 'account download.')
parser.add_option( parser.add_option(
'-p', '--prefix', dest='prefix', '-p', '--prefix', dest='prefix',
help='Only download items beginning with the <prefix>.') help='Only download items beginning with the <prefix>.')
@ -297,14 +298,16 @@ def st_download(parser, args, thread_manager):
'Specifying "-" as <out_file> will redirect to stdout.') 'Specifying "-" as <out_file> will redirect to stdout.')
parser.add_option( parser.add_option(
'', '--object-threads', type=int, '', '--object-threads', type=int,
default=10, help='Number of threads to use for downloading objects') default=10, help='Number of threads to use for downloading objects. '
'Default is 10')
parser.add_option( parser.add_option(
'', '--container-threads', type=int, default=10, '', '--container-threads', type=int, default=10,
help='Number of threads to use for downloading containers') help='Number of threads to use for downloading containers. '
'Default is 10')
parser.add_option( parser.add_option(
'', '--no-download', action='store_true', '', '--no-download', action='store_true',
default=False, default=False,
help="Perform download(s), but don't actually write anything to disk") help="Perform download(s), but don't actually write anything to disk.")
parser.add_option( parser.add_option(
'-H', '--header', action='append', dest='header', '-H', '--header', action='append', dest='header',
default=[], default=[],
@ -314,7 +317,7 @@ def st_download(parser, args, thread_manager):
parser.add_option( parser.add_option(
'--skip-identical', action='store_true', dest='skip_identical', '--skip-identical', action='store_true', dest='skip_identical',
default=False, help='Skip downloading files that are identical on ' default=False, help='Skip downloading files that are identical on '
'both sides') 'both sides.')
(options, args) = parse_args(parser, args) (options, args) = parse_args(parser, args)
args = args[1:] args = args[1:]
if options.out_file == '-': if options.out_file == '-':
@ -511,13 +514,14 @@ st_list_help = '''
Lists the containers for the account or the objects for a container Lists the containers for the account or the objects for a container
Positional arguments: Positional arguments:
[container] Name of container to list object in [container] Name of container to list object in.
Optional arguments: Optional arguments:
--long Long listing format, similar to ls -l --long Long listing format, similar to ls -l.
--lh Report sizes in human readable format similar to ls -lh --lh Report sizes in human readable format similar to
--totals Used with -l or --lh, only report totals ls -lh.
--prefix Only list items beginning with the prefix --totals Used with -l or --lh, only report totals.
--prefix Only list items beginning with the prefix.
--delimiter Roll up items with the given delimiter. For containers --delimiter Roll up items with the given delimiter. For containers
only. See OpenStack Swift API documentation for what only. See OpenStack Swift API documentation for what
this means. this means.
@ -533,9 +537,8 @@ def st_list(parser, args, thread_manager):
default=False, help='Report sizes in human readable format ' default=False, help='Report sizes in human readable format '
"similar to ls -lh.") "similar to ls -lh.")
parser.add_option( parser.add_option(
'-t', '--totals', dest='totals', help='used with -l or --lh, ' '-t', '--totals', dest='totals', action='store_true', default=False,
'only report totals', help='Used with -l or --lh, only report totals.')
action='store_true', default=False)
parser.add_option( parser.add_option(
'-p', '--prefix', dest='prefix', '-p', '--prefix', dest='prefix',
help='Only list items beginning with the prefix.') help='Only list items beginning with the prefix.')
@ -632,12 +635,13 @@ st_stat_help = '''
Displays information for the account, container, or object Displays information for the account, container, or object
Positional arguments: Positional arguments:
[container] Name of container to stat from [container] Name of container to stat from.
[object] Name of object to stat. Specify multiple times [object] Name of object to stat. Specify multiple times
for multiple objects for multiple objects.
Optional arguments: Optional arguments:
--lh Report sizes in human readable format similar to ls -lh --lh Report sizes in human readable format similar to
ls -lh.
'''.strip('\n') '''.strip('\n')
@ -690,9 +694,9 @@ Updates meta information for the account, container, or object.
If the container is not found, it will be created automatically. If the container is not found, it will be created automatically.
Positional arguments: Positional arguments:
[container] Name of container to post to [container] Name of container to post to.
[object] Name of object to post. Specify multiple times [object] Name of object to post. Specify multiple times
for multiple objects for multiple objects.
Optional arguments: Optional arguments:
--read-acl <acl> Read ACL for containers. Quick summary of ACL syntax: --read-acl <acl> Read ACL for containers. Quick summary of ACL syntax:
@ -700,8 +704,8 @@ Optional arguments:
account2:user2 account2:user2
--write-acl <acl> Write ACL for containers. Quick summary of ACL syntax: --write-acl <acl> Write ACL for containers. Quick summary of ACL syntax:
account1 account2:user2 account1 account2:user2
--sync-to <sync-to> Sync To for containers, for multi-cluster replication --sync-to <sync-to> Sync To for containers, for multi-cluster replication.
--sync-key <sync-key> Sync Key for containers, for multi-cluster replication --sync-key <sync-key> Sync Key for containers, for multi-cluster replication.
--meta <name:value> Sets a meta data item. This option may be repeated. --meta <name:value> Sets a meta data item. This option may be repeated.
Example: -m Color:Blue -m Size:Large Example: -m Color:Blue -m Size:Large
--header <header> Set request headers. This option may be repeated. --header <header> Set request headers. This option may be repeated.
@ -797,24 +801,24 @@ st_upload_help = '''
Uploads specified files and directories to the given container Uploads specified files and directories to the given container
Positional arguments: Positional arguments:
<container> Name of container to upload to <container> Name of container to upload to.
<file_or_directory> Name of file or directory to upload. Specify multiple <file_or_directory> Name of file or directory to upload. Specify multiple
times for multiple uploads times for multiple uploads.
Optional arguments: Optional arguments:
--changed Only upload files that have changed since the last --changed Only upload files that have changed since the last
upload upload.
--skip-identical Skip uploading files that are identical on both sides --skip-identical Skip uploading files that are identical on both sides.
--segment-size <size> Upload files in segments no larger than <size> and --segment-size <size> Upload files in segments no larger than <size> and
then create a "manifest" file that will download all then create a "manifest" file that will download all
the segments as if it were the original file the segments as if it were the original file.
--segment-container <container> --segment-container <container>
Upload the segments into the specified container. If Upload the segments into the specified container. If
not specified, the segments will be uploaded to a not specified, the segments will be uploaded to a
<container>_segments container so as to not pollute the <container>_segments container so as to not pollute the
main <container> listings. main <container> listings.
--leave-segments Indicates that you want the older segments of manifest --leave-segments Indicates that you want the older segments of manifest
objects left alone (in the case of overwrites) objects left alone (in the case of overwrites).
--object-threads <threads> --object-threads <threads>
Number of threads to use for uploading full objects. Number of threads to use for uploading full objects.
Default is 10. Default is 10.
@ -824,13 +828,13 @@ Optional arguments:
--header <header> Set request headers with the syntax header:value. --header <header> Set request headers with the syntax header:value.
This option may be repeated. This option may be repeated.
Example -H "content-type:text/plain". Example -H "content-type:text/plain".
--use-slo When used in conjunction with --segment-size will --use-slo When used in conjunction with --segment-size it will
create a Static Large Object instead of the default create a Static Large Object instead of the default
Dynamic Large Object. Dynamic Large Object.
--object-name <object-name> --object-name <object-name>
Upload file and name object to <object-name> or upload Upload file and name object to <object-name> or upload
dir and use <object-name> as object prefix instead of dir and use <object-name> as object prefix instead of
folder name folder name.
'''.strip('\n') '''.strip('\n')
@ -842,7 +846,7 @@ def st_upload(parser, args, thread_manager):
parser.add_option( parser.add_option(
'--skip-identical', action='store_true', dest='skip_identical', '--skip-identical', action='store_true', dest='skip_identical',
default=False, help='Skip uploading files that are identical on ' default=False, help='Skip uploading files that are identical on '
'both sides') 'both sides.')
parser.add_option( parser.add_option(
'-S', '--segment-size', dest='segment_size', help='Upload files ' '-S', '--segment-size', dest='segment_size', help='Upload files '
'in segments no larger than <size> and then create a "manifest" ' 'in segments no larger than <size> and then create a "manifest" '
@ -858,7 +862,7 @@ def st_upload(parser, args, thread_manager):
'', '--leave-segments', action='store_true', '', '--leave-segments', action='store_true',
dest='leave_segments', default=False, help='Indicates that you want ' dest='leave_segments', default=False, help='Indicates that you want '
'the older segments of manifest objects left alone (in the case of ' 'the older segments of manifest objects left alone (in the case of '
'overwrites)') 'overwrites).')
parser.add_option( parser.add_option(
'', '--object-threads', type=int, default=10, '', '--object-threads', type=int, default=10,
help='Number of threads to use for uploading full objects. ' help='Number of threads to use for uploading full objects. '
@ -874,7 +878,7 @@ def st_upload(parser, args, thread_manager):
'-H "Content-Length: 4000"') '-H "Content-Length: 4000"')
parser.add_option( parser.add_option(
'', '--use-slo', action='store_true', default=False, '', '--use-slo', action='store_true', default=False,
help='When used in conjunction with --segment-size will ' help='When used in conjunction with --segment-size it will '
'create a Static Large Object instead of the default ' 'create a Static Large Object instead of the default '
'Dynamic Large Object.') 'Dynamic Large Object.')
parser.add_option( parser.add_option(
@ -1312,16 +1316,16 @@ Command-line interface to the OpenStack Swift API.
Positional arguments: Positional arguments:
<subcommand> <subcommand>
delete Delete a container or objects within a container delete Delete a container or objects within a container.
download Download objects from containers download Download objects from containers.
list Lists the containers for the account or the objects list Lists the containers for the account or the objects
for a container for a container.
post Updates meta information for the account, container, post Updates meta information for the account, container,
or object; creates containers if not present or object; creates containers if not present.
stat Displays information for the account, container, stat Displays information for the account, container,
or object or object.
upload Uploads files or directories to the given container upload Uploads files or directories to the given container
capabilities List cluster capabilities capabilities List cluster capabilities.
Examples: Examples:
@ -1453,7 +1457,7 @@ Examples:
default=True, default=True,
help='This option is deprecated and not used anymore. ' help='This option is deprecated and not used anymore. '
'SSL compression should be disabled by default ' 'SSL compression should be disabled by default '
'by the system SSL library') 'by the system SSL library.')
parser.disable_interspersed_args() parser.disable_interspersed_args()
(options, args) = parse_args(parser, argv[1:], enforce_requires=False) (options, args) = parse_args(parser, argv[1:], enforce_requires=False)
parser.enable_interspersed_args() parser.enable_interspersed_args()