Skip to content

Commit 6caf618

Browse files
committed
changed to get_doc function, since that makes use simpler
commit right version this time :-) Changed implementation to now return the doc correctly, test with `mx help unittest` typo fix
1 parent b4ceab6 commit 6caf618

3 files changed

Lines changed: 6 additions & 14 deletions

File tree

mx.py

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13654,16 +13654,7 @@ def help_(args):
1365413654
abort('mx: command \'{0}\' is ambiguous\n {1}'.format(name, ' '.join(hits)))
1365513655

1365613656
command = _mx_commands.commands()[name]
13657-
doc = command.command_function.__doc__
13658-
if command.has_documentation():
13659-
format_args = []
13660-
if command.usage_msg:
13661-
format_args.append(command.usage_msg)
13662-
if command.doc_function:
13663-
format_args.append(command.doc_function())
13664-
13665-
doc = doc.format(*format_args)
13666-
print 'mx {0} {1}\n\n{2}\n'.format(name, command.usage_msg, doc)
13657+
print '\nmx {0} {1}\n\n{2}\n'.format(name, command.usage_msg, command.get_doc())
1366713658

1366813659
def _parse_multireleasejar_version(value):
1366913660
try:

mx_commands.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,10 @@ def __init__(self, mx_commands, command_function, suite_name, command, usage_msg
125125
def command_function(self):
126126
return self._command_function
127127

128-
def has_documentation(self):
129-
return self.doc_function != None
128+
def get_doc(self):
129+
if self.doc_function:
130+
return self.doc_function()
131+
return '<no documentation>'
130132

131133
def __call__(self, *args, **kwargs):
132134
for callback in self._mx_commands.command_before_callbacks:

mx_unittest.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,6 @@ def _run_vm(vmArgs, mainClass, mainClassArgs):
312312
os.remove(testfile)
313313

314314
unittestHelpSuffix = """
315-
316315
To avoid conflicts with VM options '--' can be used as delimiter.
317316
318317
If test filters are supplied, only tests whose fully qualified name
@@ -351,7 +350,7 @@ def is_strictly_positive(value):
351350
@mx.command(suite_name="mx",
352351
command_name='unittest',
353352
usage_msg='[unittest options] [--] [VM options] [filters...]',
354-
doc_function=unittestHelpSuffix,
353+
doc_function=lambda: unittestHelpSuffix,
355354
auto_add=False)
356355
def unittest(args):
357356
"""run the JUnit tests"""

0 commit comments

Comments
 (0)