ThirdParty/Pygments/pygments/cmdline.py

changeset 2426
da76c71624de
parent 1705
b0fbc9300f2b
child 2525
8b507a9a2d40
diff -r ace8a08028f3 -r da76c71624de ThirdParty/Pygments/pygments/cmdline.py
--- a/ThirdParty/Pygments/pygments/cmdline.py	Sun Feb 17 19:05:40 2013 +0100
+++ b/ThirdParty/Pygments/pygments/cmdline.py	Sun Feb 17 19:07:15 2013 +0100
@@ -5,7 +5,7 @@
 
     Command line interface.
 
-    :copyright: Copyright 2006-2012 by the Pygments team, see AUTHORS.
+    :copyright: Copyright 2006-2013 by the Pygments team, see AUTHORS.
     :license: BSD, see LICENSE for details.
 """
 import sys
@@ -192,6 +192,14 @@
 
     usage = USAGE % ((args[0],) * 6)
 
+    if sys.platform in ['win32', 'cygwin']:
+        try:
+            # Provide coloring under Windows, if possible
+            import colorama
+            colorama.init()
+        except ImportError:
+            pass
+
     try:
         popts, args = getopt.getopt(args[1:], "l:f:F:o:O:P:LS:a:N:hVHg")
     except getopt.GetoptError as err:
@@ -219,7 +227,7 @@
         return 0
 
     if opts.pop('-V', None) is not None:
-        print('Pygments version %s, (c) 2006-2011 by Georg Brandl.' % __version__)
+        print('Pygments version %s, (c) 2006-2013 by Georg Brandl.' % __version__)
         return 0
 
     # handle ``pygmentize -L``
@@ -370,9 +378,9 @@
             except ClassNotFound as err:
                 if '-g' in opts:
                     try:
-                        lexer = guess_lexer(code)
+                        lexer = guess_lexer(code, **parsed_opts)
                     except ClassNotFound:
-                        lexer = TextLexer()
+                        lexer = TextLexer(**parsed_opts)
                 else:
                     print('Error:', err, file=sys.stderr)
                     return 1
@@ -384,9 +392,9 @@
         if '-g' in opts:
             code = sys.stdin.read()
             try:
-                lexer = guess_lexer(code)
+                lexer = guess_lexer(code, **parsed_opts)
             except ClassNotFound:
-                lexer = TextLexer()
+                lexer = TextLexer(**parsed_opts)
         elif not lexer:
             print('Error: no lexer name given and reading ' + \
                                 'from stdin (try using -g or -l <lexer>)', file=sys.stderr)

eric ide

mercurial