[O] Refactor global cfg

This commit is contained in:
Azalea (on HyDEV-Daisy) 2022-06-19 21:22:36 -04:00
parent a1d687d3bd
commit 59f5fd5651
4 changed files with 43 additions and 23 deletions

View file

@ -1,12 +1,12 @@
from __future__ import annotations
import os
from dataclasses import dataclass
from pathlib import Path
CONFIG_PATH = Path.home() / '.config/hyfetch.json'
VERSION = '1.0.7'
# Global color mode default to 8-bit for compatibility
COLOR_MODE = '8bit'
# Obtain terminal size
try:
TERM_LEN = os.get_terminal_size().columns
@ -28,3 +28,13 @@ _/\_ _/_/\_
| |(_( | |""".strip('\n')
TEST_ASCII_WIDTH = max(len(line) for line in TEST_ASCII.split('\n'))
@dataclass
class GlobalConfig:
# Global color mode default to 8-bit for compatibility
color_mode: str
override_distro: str | None
debug: bool
GLOBAL_CFG = GlobalConfig(color_mode='8bit', override_distro=None, debug=False)