Mercurial > hg > graal-compiler
changeset 6284:e952911afd2f
made mx help command accept abbreviations
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Thu, 23 Aug 2012 15:43:40 +0200 |
parents | 076c5635774d |
children | 471b9eb7419d 89ed4e8c45c4 |
files | mxtool/mx.py |
diffstat | 1 files changed, 8 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/mxtool/mx.py Wed Aug 22 16:21:14 2012 +0200 +++ b/mxtool/mx.py Thu Aug 23 15:43:40 2012 +0200 @@ -1443,9 +1443,7 @@ """run Checkstyle on the Java sources Run Checkstyle over the Java sources. Any errors or warnings - produced by Checkstyle result in a non-zero exit code. - -If no projects are given, then all Java projects are checked.""" + produced by Checkstyle result in a non-zero exit code.""" for p in sorted_deps(): if p.native: @@ -1601,7 +1599,13 @@ name = args[0] if not commands.has_key(name): - _argParser.error('unknown command: ' + name) + hits = [c for c in commands.iterkeys() if c.startswith(name)] + if len(hits) == 1: + name = hits[0] + elif len(hits) == 0: + abort('mx: unknown command \'{0}\'\n{1}use "mx help" for more options'.format(name, _format_commands())) + else: + abort('mx: command \'{0}\' is ambiguous\n {1}'.format(name, ' '.join(hits))) value = commands[name] (func, usage) = value[:2]