[lit] Add --version option.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203496 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Daniel Dunbar 2014-03-10 21:57:48 +00:00
parent 55aa019282
commit a99759357a

View File

@ -136,6 +136,9 @@ def main(builtinParameters = {}):
from optparse import OptionParser, OptionGroup
parser = OptionParser("usage: %prog [options] {file-or-path}")
parser.add_option("", "--version", dest="show_version",
help="Show version and exit",
action="store_true", default=False)
parser.add_option("-j", "--threads", dest="numThreads", metavar="N",
help="Number of testing threads",
type=int, action="store", default=None)
@ -228,6 +231,10 @@ def main(builtinParameters = {}):
(opts, args) = parser.parse_args()
if opts.show_version:
print "lit %s" % (lit.__version__,)
return
if not args:
parser.error('No inputs specified')