2e99c3f5e7ee

Add --version
[view raw] [browse files]
author Steve Losh <steve@stevelosh.com>
date Wed, 09 Dec 2015 12:05:10 +0000
parents 4602c8a6735a
children cad6895cb413
branches/tags (none)
files ffind

Changes

--- a/ffind	Wed Dec 09 11:57:46 2015 +0000
+++ b/ffind	Wed Dec 09 12:05:10 2015 +0000
@@ -18,6 +18,7 @@
 
 
 # Constants -------------------------------------------------------------------
+VERSION = ('1', '0', '0')
 CASE_SENSITIVE = 1
 CASE_INSENSITIVE = 2
 CASE_SMART = 3
@@ -500,6 +501,9 @@
     p = OptionParser("usage: %prog [options] PATTERN")
 
     # Main options
+    p.add_option('--version',
+                 action='store_true', default=False,
+                 help='print the version and exit')
     p.add_option('-d', '--dir', default='.',
                  help='root the search in DIR (default .)',
                  metavar='DIR')
@@ -785,6 +789,10 @@
 
     (options, args) = build_option_parser().parse_args()
 
+    if options.version:
+        print('friendly-find version %s' % '.'.join(VERSION))
+        sys.exit(0)
+
     # PATTERN
     if len(args) > 1:
         die("only one search pattern can be given")