You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@aurora.apache.org by mc...@apache.org on 2014/06/09 22:17:35 UTC
git commit: Variety of help fixes.
Repository: incubator-aurora
Updated Branches:
refs/heads/master b524726dc -> 92e32ec8c
Variety of help fixes.
- Fixed glitch with string handling in "aurora help noun verb".
- Modified parameter name defaulting to produce better usage strings.
- Added whitespace between lines of a noun's usage message.
- Added missing parameter help messages for "job list" and "job status" parameters.
Bugs closed: aurora-437, aurora-508
Reviewed at https://reviews.apache.org/r/22243/
Project: http://git-wip-us.apache.org/repos/asf/incubator-aurora/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-aurora/commit/92e32ec8
Tree: http://git-wip-us.apache.org/repos/asf/incubator-aurora/tree/92e32ec8
Diff: http://git-wip-us.apache.org/repos/asf/incubator-aurora/diff/92e32ec8
Branch: refs/heads/master
Commit: 92e32ec8c7a74adad620fa8fd20dfa93422e81e4
Parents: b524726
Author: Mark Chu-Carroll <mc...@twopensource.com>
Authored: Mon Jun 9 16:14:04 2014 -0400
Committer: Mark Chu-Carroll <mc...@twitter.com>
Committed: Mon Jun 9 16:14:04 2014 -0400
----------------------------------------------------------------------
src/main/python/apache/aurora/client/cli/__init__.py | 4 ++--
src/main/python/apache/aurora/client/cli/jobs.py | 7 ++++---
src/main/python/apache/aurora/client/cli/options.py | 14 ++++++++------
3 files changed, 14 insertions(+), 11 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/92e32ec8/src/main/python/apache/aurora/client/cli/__init__.py
----------------------------------------------------------------------
diff --git a/src/main/python/apache/aurora/client/cli/__init__.py b/src/main/python/apache/aurora/client/cli/__init__.py
index 552f9f1..4e018f1 100644
--- a/src/main/python/apache/aurora/client/cli/__init__.py
+++ b/src/main/python/apache/aurora/client/cli/__init__.py
@@ -451,7 +451,7 @@ class Noun(AuroraCommand):
result = ['Usage for noun "%s":' % self.name]
result += [" %s %s" % (self.name, self.verbs[verb].usage) for verb in self.verbs]
result += [self.help]
- return "\n".join(result)
+ return "\n\n".join(result)
def execute(self, context):
if context.options.verb not in self.verbs:
@@ -485,7 +485,7 @@ class Verb(AuroraCommand):
def composed_help(self):
"""Generate the composed help message shown when the user requests help about this verb"""
result = ['Usage for verb "%s %s":' % (self.noun.name, self.name)]
- result += [" " + s for s in self.usage]
+ result += [" " + self.usage]
result += ["Options:"]
for opt in self.get_options():
result += [" " + s for s in opt.render_help()]
http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/92e32ec8/src/main/python/apache/aurora/client/cli/jobs.py
----------------------------------------------------------------------
diff --git a/src/main/python/apache/aurora/client/cli/jobs.py b/src/main/python/apache/aurora/client/cli/jobs.py
index e7c3ee4..4fa03a6 100644
--- a/src/main/python/apache/aurora/client/cli/jobs.py
+++ b/src/main/python/apache/aurora/client/cli/jobs.py
@@ -64,7 +64,8 @@ from gen.apache.aurora.api.ttypes import ExecutorConfig, ResponseCode, ScheduleS
def arg_type_jobkey(key):
return AuroraCommandContext.parse_partial_jobkey(key)
-
+WILDCARD_JOBKEY_OPTION = CommandOption('jobspec', type=arg_type_jobkey,
+ help="A jobkey, optionally containing wildcards")
class CancelUpdateCommand(Verb):
@property
@@ -393,7 +394,7 @@ class ListJobsCommand(Verb):
return "list"
def get_options(self):
- return [CommandOption("jobspec", type=arg_type_jobkey)]
+ return [WILDCARD_JOBKEY_OPTION]
def execute(self, context):
jobs = context.get_jobs_matching_key(context.options.jobspec)
@@ -497,7 +498,7 @@ The jobspec parameter can omit parts of the jobkey, or use shell-style globs."""
return "status"
def get_options(self):
- return [JSON_WRITE_OPTION, CommandOption("jobspec", type=arg_type_jobkey)]
+ return [JSON_WRITE_OPTION, WILDCARD_JOBKEY_OPTION]
def render_tasks_json(self, jobkey, active_tasks, inactive_tasks):
"""Render the tasks running for a job in machine-processable JSON format."""
http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/92e32ec8/src/main/python/apache/aurora/client/cli/options.py
----------------------------------------------------------------------
diff --git a/src/main/python/apache/aurora/client/cli/options.py b/src/main/python/apache/aurora/client/cli/options.py
index f10ef4c..bb61dbe 100644
--- a/src/main/python/apache/aurora/client/cli/options.py
+++ b/src/main/python/apache/aurora/client/cli/options.py
@@ -34,10 +34,10 @@ class CommandOption(object):
break
else:
raise ValueError('CommandOption had no valid name.')
- self.args = args
- self.kwargs = kwargs
- self.type = kwargs.get('type')
- self.help = kwargs.get('help', '')
+ self.args = args[:]
+ self.kwargs = kwargs.copy()
+ self.type = self.kwargs.get('type')
+ self.help = self.kwargs.get('help', '')
def is_mandatory(self):
return self.kwargs.get('required', not self.name.startswith('--'))
@@ -52,8 +52,10 @@ class CommandOption(object):
displayname = self.type
elif isinstance(self.type, Compatibility.integer):
displayname = "int",
+ elif self.name.startswith('--'):
+ displayname = self.name[2:]
else:
- displayname = "value"
+ displayname = self.name
return displayname
def render_usage(self):
@@ -80,7 +82,7 @@ class CommandOption(object):
elif self.type is None and "choices" in self.kwargs:
result = "%s=%s" % (self.name, self.kwargs["choices"])
else:
- result = "%s=%s" % (self.name, self.get_displayname())
+ result = "%s" % (self.get_displayname())
return [result, "\t" + self.help]
def add_to_parser(self, parser):