comparison mxtool/mx.py @ 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 c21886d4e125
children 897f5bb96d60
comparison
equal deleted inserted replaced
6283:076c5635774d 6284:e952911afd2f
1441 1441
1442 def checkstyle(args): 1442 def checkstyle(args):
1443 """run Checkstyle on the Java sources 1443 """run Checkstyle on the Java sources
1444 1444
1445 Run Checkstyle over the Java sources. Any errors or warnings 1445 Run Checkstyle over the Java sources. Any errors or warnings
1446 produced by Checkstyle result in a non-zero exit code. 1446 produced by Checkstyle result in a non-zero exit code."""
1447
1448 If no projects are given, then all Java projects are checked."""
1449 1447
1450 for p in sorted_deps(): 1448 for p in sorted_deps():
1451 if p.native: 1449 if p.native:
1452 continue 1450 continue
1453 sourceDirs = p.source_dirs() 1451 sourceDirs = p.source_dirs()
1599 _argParser.print_help() 1597 _argParser.print_help()
1600 return 1598 return
1601 1599
1602 name = args[0] 1600 name = args[0]
1603 if not commands.has_key(name): 1601 if not commands.has_key(name):
1604 _argParser.error('unknown command: ' + name) 1602 hits = [c for c in commands.iterkeys() if c.startswith(name)]
1603 if len(hits) == 1:
1604 name = hits[0]
1605 elif len(hits) == 0:
1606 abort('mx: unknown command \'{0}\'\n{1}use "mx help" for more options'.format(name, _format_commands()))
1607 else:
1608 abort('mx: command \'{0}\' is ambiguous\n {1}'.format(name, ' '.join(hits)))
1605 1609
1606 value = commands[name] 1610 value = commands[name]
1607 (func, usage) = value[:2] 1611 (func, usage) = value[:2]
1608 doc = func.__doc__ 1612 doc = func.__doc__
1609 if len(value) > 2: 1613 if len(value) > 2: