Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 1 addition & 10 deletions mx.py
Original file line number Diff line number Diff line change
Expand Up @@ -13679,16 +13679,7 @@ def help_(args):
abort('mx: command \'{0}\' is ambiguous\n {1}'.format(name, ' '.join(hits)))

command = _mx_commands.commands()[name]
doc = command.command_function.__doc__
if command.has_documentation():
format_args = []
if command.usage_msg:
format_args.append(command.usage_msg)
if command.doc_function:
format_args.append(command.doc_function())

doc = doc.format(*format_args)
print 'mx {0} {1}\n\n{2}\n'.format(name, command.usage_msg, doc)
print command.get_doc()

def _parse_multireleasejar_version(value):
try:
Expand Down
14 changes: 14 additions & 0 deletions mx_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,20 @@ def __init__(self, mx_commands, command_function, suite_name, command, usage_msg
def command_function(self):
return self._command_function

def get_doc(self):
doc = 'mx {0} {1}'
msg = '<no documentation>'
if self.command_function.__doc__ or self.doc_function or self.usage_msg:
msg = ''
if self.usage_msg:
msg += self.usage_msg
if self.command_function.__doc__:
msg += '\n\n' + self.command_function.__doc__
if self.doc_function:
msg += '\n' + self.doc_function()

return doc.format(self.command, msg)

def __call__(self, *args, **kwargs):
for callback in self._mx_commands.command_before_callbacks:
callback(self, *args, **kwargs)
Expand Down
3 changes: 1 addition & 2 deletions mx_unittest.py
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,6 @@ def _run_vm(vmArgs, mainClass, mainClassArgs):
os.remove(testfile)

unittestHelpSuffix = """

To avoid conflicts with VM options '--' can be used as delimiter.

If test filters are supplied, only tests whose fully qualified name
Expand Down Expand Up @@ -351,7 +350,7 @@ def is_strictly_positive(value):
@mx.command(suite_name="mx",
command_name='unittest',
usage_msg='[unittest options] [--] [VM options] [filters...]',
doc_function=unittestHelpSuffix,
doc_function=lambda: unittestHelpSuffix,
auto_add=False)
def unittest(args):
"""run the JUnit tests"""
Expand Down