Пример #1
0
    'upower',
    'uptime',
    'w',
    'wc',
    'who',
    'xml',
    'yaml'
]

JC_ERROR_EXIT = 100


# List of custom or override parsers.
# Allow any <user_data_dir>/jc/jcparsers/*.py
local_parsers = []
data_dir = appdirs.user_data_dir('jc', 'jc')
local_parsers_dir = os.path.join(data_dir, 'jcparsers')
if os.path.isdir(local_parsers_dir):
    sys.path.append(data_dir)
    for name in os.listdir(local_parsers_dir):
        if re.match(r'\w+\.py', name) and os.path.isfile(os.path.join(local_parsers_dir, name)):
            plugin_name = name[0:-3]
            local_parsers.append(plugin_name)
            if plugin_name not in parsers:
                parsers.append(plugin_name)


# We only support 2.3.0+, pygments changed color names in 2.4.0.
# startswith is sufficient and avoids potential exceptions from split and int.
if pygments_installed:
    if pygments.__version__.startswith('2.3.'):
Пример #2
0
Файл: cli.py Проект: pm-hwks/jc
__version__ = info.version

parsers = [
    'airport', 'airport-s', 'arp', 'blkid', 'crontab', 'crontab-u', 'csv',
    'df', 'dig', 'dmidecode', 'du', 'env', 'file', 'free', 'fstab', 'group',
    'gshadow', 'history', 'hosts', 'id', 'ifconfig', 'ini', 'iptables', 'jobs',
    'last', 'ls', 'lsblk', 'lsmod', 'lsof', 'mount', 'netstat', 'ntpq',
    'passwd', 'pip-list', 'pip-show', 'ps', 'route', 'shadow', 'ss', 'stat',
    'systemctl', 'systemctl-lj', 'systemctl-ls', 'systemctl-luf',
    'timedatectl', 'uname', 'uptime', 'w', 'who', 'xml', 'yaml'
]

# List of custom or override parsers.
# Allow any <user_data_dir>/jc/jcparsers/*.py
local_parsers = []
data_dir = appdirs.user_data_dir("jc", "jc")
local_parsers_dir = os.path.join(data_dir, "jcparsers")
if os.path.isdir(local_parsers_dir):
    sys.path.append(data_dir)
    for name in os.listdir(local_parsers_dir):
        if re.match(r'\w+\.py', name) and os.path.isfile(
                os.path.join(local_parsers_dir, name)):
            plugin_name = name[0:-3]
            local_parsers.append(plugin_name)
            if plugin_name not in parsers:
                parsers.append(plugin_name)


def set_env_colors():
    """
    Grab custom colors from JC_COLORS environment variable. JC_COLORS env variable takes 4 comma