|
@@ -2,10 +2,12 @@
|
2
|
2
|
# -*- coding: utf-8 -*-
|
3
|
3
|
|
4
|
4
|
"""
|
5
|
|
-View colored, incremental diff in unified format or in side by side mode with
|
6
|
|
-auto pager. Requires Python (>= 2.5.0) and less.
|
|
5
|
+Term based tool to view colored, incremental diff in unified format or side by
|
|
6
|
+side with auto pager. Requires Python (>= 2.5.0) and less.
|
7
|
7
|
|
8
|
|
-See demo at homepage: https://github.com/ymattw/cdiff
|
|
8
|
+AUTHOR : Matthew Wang <mattwyl(@)gmail(.)com>
|
|
9
|
+LICENSE : BSD-3
|
|
10
|
+HOMEPAGE: https://github.com/ymattw/cdiff
|
9
|
11
|
"""
|
10
|
12
|
|
11
|
13
|
import sys
|
|
@@ -22,6 +24,10 @@ import errno
|
22
|
24
|
import difflib
|
23
|
25
|
|
24
|
26
|
|
|
27
|
+# REMEMBER UPDATE ``CHANGES``
|
|
28
|
+__version__ = '0.1'
|
|
29
|
+
|
|
30
|
+
|
25
|
31
|
COLORS = {
|
26
|
32
|
'reset' : '\x1b[0m',
|
27
|
33
|
'underline' : '\x1b[4m',
|
|
@@ -519,14 +525,15 @@ def main():
|
519
|
525
|
|
520
|
526
|
supported_vcs = [check[0] for check, _ in REVISION_CONTROL]
|
521
|
527
|
|
522
|
|
- usage = '%s [options] [diff]' % os.path.basename(sys.argv[0])
|
|
528
|
+ usage = '%prog [options] [diff]'
|
523
|
529
|
description= ('View colored, incremental diff in unified format or '
|
524
|
530
|
'side by side with auto pager. Read diff from diff '
|
525
|
531
|
'(patch) file if given, or stdin if redirected, or '
|
526
|
532
|
'diff produced by revision tool if in a %s workspace') \
|
527
|
533
|
% '/'.join(supported_vcs)
|
528
|
534
|
|
529
|
|
- parser = optparse.OptionParser(usage=usage, description=description)
|
|
535
|
+ parser = optparse.OptionParser(usage=usage, description=description,
|
|
536
|
+ version='%%prog %s' % __version__)
|
530
|
537
|
parser.add_option('-s', '--side-by-side', action='store_true',
|
531
|
538
|
help=('show in side-by-side mode'))
|
532
|
539
|
parser.add_option('-w', '--width', type='int', default=80, metavar='N',
|