# HG changeset patch # User Doug Simon # Date 1345729420 -7200 # Node ID e952911afd2f9d7d670a81cd7c5cab355124e4b1 # Parent 076c5635774d47b05119d8531bba7c7c07d4bcc6 made mx help command accept abbreviations diff -r 076c5635774d -r e952911afd2f mxtool/mx.py --- 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]