[O] Refactor global cfg
This commit is contained in:
parent
a1d687d3bd
commit
59f5fd5651
4 changed files with 43 additions and 23 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue