mirror of https://github.com/cheat/cheat.git
Add a check for posix environment for pygments.
This commit is contained in:
parent
39a15a669a
commit
f89d887c21
20
cheat
20
cheat
|
@ -2,14 +2,18 @@
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
try:
|
USE_PYGMENTS = False
|
||||||
from pygments import highlight
|
|
||||||
from pygments.util import ClassNotFound
|
# NOTE remove this check if it is confirmed to work on windows
|
||||||
from pygments.lexers import get_lexer_for_filename, TextLexer
|
if os.name == 'posix':
|
||||||
from pygments.formatters import TerminalFormatter
|
try:
|
||||||
USE_PYGMENTS = True
|
from pygments import highlight
|
||||||
except ImportError:
|
from pygments.util import ClassNotFound
|
||||||
USE_PYGMENTS = False
|
from pygments.lexers import get_lexer_for_filename, TextLexer
|
||||||
|
from pygments.formatters import TerminalFormatter
|
||||||
|
USE_PYGMENTS = True
|
||||||
|
except ImportError:
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
def cheat_directories():
|
def cheat_directories():
|
||||||
|
|
Loading…
Reference in New Issue