mirror of
https://github.com/kellyjonbrazil/jc.git
synced 2025-06-19 00:17:51 +02:00
move pygments colors to cli_data.py
This commit is contained in:
40
jc/cli.py
40
jc/cli.py
@ -14,7 +14,7 @@ from .lib import (__version__, parser_info, all_parser_info, parsers,
|
|||||||
_get_parser, _parser_is_streaming, standard_parser_mod_list,
|
_get_parser, _parser_is_streaming, standard_parser_mod_list,
|
||||||
plugin_parser_mod_list, streaming_parser_mod_list)
|
plugin_parser_mod_list, streaming_parser_mod_list)
|
||||||
from . import utils
|
from . import utils
|
||||||
from .cli_data import long_options_map
|
from .cli_data import long_options_map, new_pygments_colors, old_pygments_colors
|
||||||
from .shell_completions import bash_completion, zsh_completion
|
from .shell_completions import bash_completion, zsh_completion
|
||||||
from . import tracebackplus
|
from . import tracebackplus
|
||||||
from .exceptions import LibraryNotInstalled, ParseError
|
from .exceptions import LibraryNotInstalled, ParseError
|
||||||
@ -48,43 +48,9 @@ class info():
|
|||||||
# startswith is sufficient and avoids potential exceptions from split and int.
|
# startswith is sufficient and avoids potential exceptions from split and int.
|
||||||
if PYGMENTS_INSTALLED:
|
if PYGMENTS_INSTALLED:
|
||||||
if pygments.__version__.startswith('2.3.'):
|
if pygments.__version__.startswith('2.3.'):
|
||||||
PYGMENT_COLOR = {
|
PYGMENT_COLOR = old_pygments_colors
|
||||||
'black': '#ansiblack',
|
|
||||||
'red': '#ansidarkred',
|
|
||||||
'green': '#ansidarkgreen',
|
|
||||||
'yellow': '#ansibrown',
|
|
||||||
'blue': '#ansidarkblue',
|
|
||||||
'magenta': '#ansipurple',
|
|
||||||
'cyan': '#ansiteal',
|
|
||||||
'gray': '#ansilightgray',
|
|
||||||
'brightblack': '#ansidarkgray',
|
|
||||||
'brightred': '#ansired',
|
|
||||||
'brightgreen': '#ansigreen',
|
|
||||||
'brightyellow': '#ansiyellow',
|
|
||||||
'brightblue': '#ansiblue',
|
|
||||||
'brightmagenta': '#ansifuchsia',
|
|
||||||
'brightcyan': '#ansiturquoise',
|
|
||||||
'white': '#ansiwhite',
|
|
||||||
}
|
|
||||||
else:
|
else:
|
||||||
PYGMENT_COLOR = {
|
PYGMENT_COLOR = new_pygments_colors
|
||||||
'black': 'ansiblack',
|
|
||||||
'red': 'ansired',
|
|
||||||
'green': 'ansigreen',
|
|
||||||
'yellow': 'ansiyellow',
|
|
||||||
'blue': 'ansiblue',
|
|
||||||
'magenta': 'ansimagenta',
|
|
||||||
'cyan': 'ansicyan',
|
|
||||||
'gray': 'ansigray',
|
|
||||||
'brightblack': 'ansibrightblack',
|
|
||||||
'brightred': 'ansibrightred',
|
|
||||||
'brightgreen': 'ansibrightgreen',
|
|
||||||
'brightyellow': 'ansibrightyellow',
|
|
||||||
'brightblue': 'ansibrightblue',
|
|
||||||
'brightmagenta': 'ansibrightmagenta',
|
|
||||||
'brightcyan': 'ansibrightcyan',
|
|
||||||
'white': 'ansiwhite',
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
def set_env_colors(env_colors=None):
|
def set_env_colors(env_colors=None):
|
||||||
|
@ -16,3 +16,41 @@ long_options_map: Dict[str, List[str]] = {
|
|||||||
'--bash-comp': ['B', 'gen Bash completion: jc -B > /etc/bash_completion.d/jc'],
|
'--bash-comp': ['B', 'gen Bash completion: jc -B > /etc/bash_completion.d/jc'],
|
||||||
'--zsh-comp': ['Z', 'gen Zsh completion: jc -Z > "${fpath[1]}/_jc"']
|
'--zsh-comp': ['Z', 'gen Zsh completion: jc -Z > "${fpath[1]}/_jc"']
|
||||||
}
|
}
|
||||||
|
|
||||||
|
new_pygments_colors = {
|
||||||
|
'black': 'ansiblack',
|
||||||
|
'red': 'ansired',
|
||||||
|
'green': 'ansigreen',
|
||||||
|
'yellow': 'ansiyellow',
|
||||||
|
'blue': 'ansiblue',
|
||||||
|
'magenta': 'ansimagenta',
|
||||||
|
'cyan': 'ansicyan',
|
||||||
|
'gray': 'ansigray',
|
||||||
|
'brightblack': 'ansibrightblack',
|
||||||
|
'brightred': 'ansibrightred',
|
||||||
|
'brightgreen': 'ansibrightgreen',
|
||||||
|
'brightyellow': 'ansibrightyellow',
|
||||||
|
'brightblue': 'ansibrightblue',
|
||||||
|
'brightmagenta': 'ansibrightmagenta',
|
||||||
|
'brightcyan': 'ansibrightcyan',
|
||||||
|
'white': 'ansiwhite',
|
||||||
|
}
|
||||||
|
|
||||||
|
old_pygments_colors = {
|
||||||
|
'black': '#ansiblack',
|
||||||
|
'red': '#ansidarkred',
|
||||||
|
'green': '#ansidarkgreen',
|
||||||
|
'yellow': '#ansibrown',
|
||||||
|
'blue': '#ansidarkblue',
|
||||||
|
'magenta': '#ansipurple',
|
||||||
|
'cyan': '#ansiteal',
|
||||||
|
'gray': '#ansilightgray',
|
||||||
|
'brightblack': '#ansidarkgray',
|
||||||
|
'brightred': '#ansired',
|
||||||
|
'brightgreen': '#ansigreen',
|
||||||
|
'brightyellow': '#ansiyellow',
|
||||||
|
'brightblue': '#ansiblue',
|
||||||
|
'brightmagenta': '#ansifuchsia',
|
||||||
|
'brightcyan': '#ansiturquoise',
|
||||||
|
'white': '#ansiwhite',
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user