mirror of
https://github.com/daylinmorgan/viv.git
synced 2024-12-22 10:40:44 -06:00
refactor: drop dataclass dependency
This commit is contained in:
parent
27d7952cb1
commit
8a5f63d5e7
1 changed files with 15 additions and 17 deletions
|
@ -31,7 +31,6 @@ from argparse import (
|
||||||
_SubParsersAction,
|
_SubParsersAction,
|
||||||
)
|
)
|
||||||
from argparse import ArgumentParser as StdArgParser
|
from argparse import ArgumentParser as StdArgParser
|
||||||
from dataclasses import dataclass
|
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from itertools import zip_longest
|
from itertools import zip_longest
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
@ -52,7 +51,7 @@ from typing import (
|
||||||
from urllib.error import HTTPError
|
from urllib.error import HTTPError
|
||||||
from urllib.request import urlopen
|
from urllib.request import urlopen
|
||||||
|
|
||||||
__version__ = "23.5a4-5-g819257c-dev"
|
__version__ = "23.5a4-6-g27d7952-dev"
|
||||||
|
|
||||||
|
|
||||||
class Config:
|
class Config:
|
||||||
|
@ -158,26 +157,25 @@ BOX: Dict[str, str] = {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
|
||||||
class Ansi:
|
class Ansi:
|
||||||
"""control ouptut of ansi(VT100) control codes"""
|
"""control ouptut of ansi(VT100) control codes"""
|
||||||
|
|
||||||
bold: str = "\033[1m"
|
def __init__(self) -> None:
|
||||||
dim: str = "\033[2m"
|
self.bold: str = "\033[1m"
|
||||||
underline: str = "\033[4m"
|
self.dim: str = "\033[2m"
|
||||||
red: str = "\033[1;31m"
|
self.underline: str = "\033[4m"
|
||||||
green: str = "\033[1;32m"
|
self.red: str = "\033[1;31m"
|
||||||
yellow: str = "\033[1;33m"
|
self.green: str = "\033[1;32m"
|
||||||
magenta: str = "\033[1;35m"
|
self.yellow: str = "\033[1;33m"
|
||||||
cyan: str = "\033[1;36m"
|
self.magenta: str = "\033[1;35m"
|
||||||
end: str = "\033[0m"
|
self.cyan: str = "\033[1;36m"
|
||||||
|
self.end: str = "\033[0m"
|
||||||
|
|
||||||
# for argparse help
|
# for argparse help
|
||||||
header: str = cyan
|
self.header: str = self.cyan
|
||||||
option: str = yellow
|
self.option: str = self.yellow
|
||||||
metavar: str = "\033[33m" # normal yellow
|
self.metavar: str = "\033[33m" # normal yellow
|
||||||
|
|
||||||
def __post_init__(self) -> None:
|
|
||||||
if os.getenv("NO_COLOR") or not sys.stderr.isatty():
|
if os.getenv("NO_COLOR") or not sys.stderr.isatty():
|
||||||
for attr in self.__dict__:
|
for attr in self.__dict__:
|
||||||
setattr(self, attr, "")
|
setattr(self, attr, "")
|
||||||
|
|
Loading…
Reference in a new issue