Merge "Add short arguments and fix small errors"

This commit is contained in:
Jenkins
2016-10-14 10:50:18 +00:00
committed by Gerrit Code Review
4 changed files with 21 additions and 18 deletions

View File

@@ -54,26 +54,28 @@ class ListArtifacts(command.Lister):
help='Name of artifact type.',
)
parser.add_argument(
'--limit',
'--limit', '-l',
default=20,
metavar='<LIMIT>',
type=int,
help='Maximum number of artifacts to get.',
)
parser.add_argument(
'--page-size',
'--page-size', '-p',
default=20,
metavar='<SIZE>',
type=int,
help='Number of artifacts to request in each paginated request.',
)
parser.add_argument(
'--filter',
'--filter', '-F',
default=[],
action='append',
metavar='<KEY=VALUE>',
help='Filtering artifact list by a user-defined property.',
)
parser.add_argument(
'--sort',
'--sort', '-s',
default='name:asc',
metavar='<key>[:<direction>]',
help='Comma-separated list of sort keys and directions in the '
@@ -149,13 +151,13 @@ class CreateArtifact(command.Lister):
help='Name of the artifact.',
),
parser.add_argument(
'--artifact-version',
'--artifact-version', '-v',
default='0.0.0',
metavar='<VERSION>',
help='Version of the artifact.',
)
parser.add_argument(
'--property',
'--property', '-p',
metavar='<key=value>',
action='append',
default=[],
@@ -196,19 +198,19 @@ class UpdateArtifact(command.Lister):
help='ID of the artifact to update.',
)
parser.add_argument(
'--name',
'--name', '-n',
metavar='<NAME>',
help='Name of the artifact.',
),
parser.add_argument(
'--remove-property',
'--remove-property', '-r',
metavar='<key>',
action='append',
default=[],
help='Property that will be removed.'
)
parser.add_argument(
'--property',
'--property', '-p',
metavar='<key=value>',
action='append',
default=[],

View File

@@ -58,7 +58,7 @@ class UploadBlob(command.ShowOne):
help='Local file that contains data to be uploaded.',
)
parser.add_argument(
'--blob-property',
'--blob-property', '-p',
metavar='<BLOB_PROPERTY>',
help='Name of the blob field.'
)
@@ -70,6 +70,7 @@ class UploadBlob(command.ShowOne):
)
parser.add_argument(
'--progress',
action='store_true',
help='Show download progress bar.'
)
return parser
@@ -119,7 +120,7 @@ class DownloadBlob(command.Command):
)
parser.add_argument(
'--progress',
default=False,
action='store_true',
help='Show download progress bar.'
)
parser.add_argument(
@@ -130,7 +131,7 @@ class DownloadBlob(command.Command):
'the blob will not be saved.'
)
parser.add_argument(
'--blob-property',
'--blob-property', '-p',
metavar='<BLOB_PROPERTY>',
default=None,
help='Name of the blob field.'

View File

@@ -82,8 +82,8 @@ class TestListArtifacts(TestArtifacts):
self.check_parser(self.cmd, arglist, verify)
def test_artifact_list_with_sort(self):
arglist = ['images', '--sort', 'name:asc']
verify = [('type_name', 'images'),
arglist = ['sample_artifact', '--sort', 'name:asc']
verify = [('type_name', 'sample_artifact'),
('sort', 'name:asc')]
self.check_parser(self.cmd, arglist, verify)
@@ -99,19 +99,19 @@ class TestListArtifacts(TestArtifacts):
def test_artifact_list_page_size(self):
arglist = ['images', '--page-size', '1']
verify = [('type_name', 'images'),
('page_size', '1')]
('page_size', 1)]
self.check_parser(self.cmd, arglist, verify)
def test_artifact_list_limit(self):
arglist = ['images', '--limit', '2']
verify = [('type_name', 'images'),
('limit', '2')]
('limit', 2)]
self.check_parser(self.cmd, arglist, verify)
def test_artifact_list_multilimit(self):
arglist = ['images', '--limit', '2', '--limit', '1']
verify = [('type_name', 'images'),
('limit', '1')]
('limit', 1)]
self.check_parser(self.cmd, arglist, verify)

View File

@@ -231,7 +231,7 @@ class TestDownloadBlob(TestBlobs):
arglist = ['images',
'fc15c365-d4f9-4b8b-a090-d9e230f1f6ba',
'--file', '/path/to/file',
'--progress', 'True']
'--progress']
verify = [('type_name', 'images')]
parsed_args = self.check_parser(self.cmd, arglist, verify)