Beispiel #1
0
from pathlib import Path
import sys
import traceback

from app_settings import app_settings

user_tags = {
    'title'     : parse('<bold><green>'),    # bold green
    'text'      : parse('<bold><white>'),    # bold white
    'alttext'   : parse('<white>'),          # white
    'name'      : parse('<bold><cyan>'),     # bold cyan
    'altname'   : parse('<cyan>'),           # cyan
    'error'     : parse('<bold><red>'),      # bold red
}

am = AnsiMarkup(tags=user_tags)

def _title_print(title):
    am.ansiprint(f'<title>{title}</title>')

def _is_only_defaults_set():
    return not app_settings.list_env and \
           not app_settings.list_env_values and \
           not app_settings.identifier and \
           (not app_settings.variables or len(app_settings.variables) == 0)

def _parse_args():
    parser = argparse.ArgumentParser(description='Pretty print environment variables')
    parser.add_argument('-v', '--verbose', action='count', default=0, help='increase output verbosity')
    parser.add_argument('-r', '--raw', action='store_true', help='print variables how they are found in the environment')
    parser.add_argument('-o', '--one-line', action="store_true", help='print variables with multiple values on one line')
Beispiel #2
0
def am():
    return AnsiMarkup()