diff --git a/chkcrontab b/chkcrontab
index 68b09fe5f3b18ac8f5d6603670aabf6f3e875bf8..40ceb456db50ec2d48122acaaaa022b66b48c1f2 100755
--- a/chkcrontab
+++ b/chkcrontab
@@ -31,23 +31,31 @@ import chkcrontab_lib as check
 
 from optparse import OptionParser
 from argparse import ArgumentParser
+try:
+  from _version import __version__
+except ImportError:
+  __version__ = 'unknown'
 
 def main(argv):
   """main program."""
   parser = ArgumentParser(
-      description="Parse crontab files and check each type of line for potential syntax errors.")
+      description='Parse crontab files; check for potential syntax errors.',
+      version=__version__)
   parser.add_argument('crontab', help='the crontab file to parse')
   parser.add_argument('-w', '--whitelist', action='append',
       dest='whitelisted_users',
-      help='A user to ignore when warning of unrecognized users  This argument may be passed multiple times.',
+      help='user to ignore when warning of unrecognized users; may be passed multiple times',
       default=['postgres', 'buildbot'])
   parser.add_argument('-n', '--no-check-passwd', action='store_false',
-      dest='check_passwd', help='Disable user lookup')
+      dest='check_passwd', help='disable user lookup')
   parser.add_argument('-q', '--quiet', action='store_true',
-      dest='quiet', help="Be quiet")
+      dest='quiet', help='be quiet')
   args = parser.parse_args()
 
   log = check.LogCounter()
+  if args.version:
+    print('Version %s\n' % __version__)
+    return 0
   if not args.quiet:
     print('Checking correctness of %s' % args.crontab)
   return check.check_crontab(args, log)
diff --git a/setup.py b/setup.py
index df72a6a339d6ffde1e6f5d92ed3c861d53d2c082..58a7e05c89dc53db24c8d9a897a3d9f1a53b4574 100755
--- a/setup.py
+++ b/setup.py
@@ -26,9 +26,9 @@ from distutils.command.install import install
 from distutils.core import setup
 from distutils.core import Command
 
-
 BASE_DIR = os.path.dirname(globals().get('__file__', os.getcwd()))
-
+VERSION = os.popen2('git describe --dirty="*" --always')[1].readline().strip()
+open('_version.py', 'w').write('__version__ = "%s"\n' % VERSION)
 
 class TestCmd(Command):
   description = 'Runs all available tests.'
@@ -171,13 +171,13 @@ if 'setuptools' not in dir():
 setup(
   cmdclass=cmdclass,
   name='chkcrontab',
-  version='1.7',
+  version=VERSION,
   url='http://code.google.com/p/chkcrontab',
   author='Kevin Lyda',
   author_email='lyda@google.com',
   description='A tool to detect crontab errors',
   long_description=open('README.rst').read(),
-  py_modules=['chkcrontab_lib'],
+  py_modules=['chkcrontab_lib', '.version'],
   scripts=['chkcrontab'],
   keywords='check lint crontab',
   # See http://pypi.python.org/pypi?%3Aaction=list_classifiers