mirror of
https://github.com/daylinmorgan/viv.git
synced 2024-11-14 04:57:53 -06:00
style: implict types fine and properly escape things
This commit is contained in:
parent
4b3d1fbea5
commit
24787a746c
1 changed files with 14 additions and 14 deletions
|
@ -182,20 +182,20 @@ class Ansi:
|
||||||
"""control ouptut of ansi(VT100) control codes"""
|
"""control ouptut of ansi(VT100) control codes"""
|
||||||
|
|
||||||
def __init__(self) -> None:
|
def __init__(self) -> None:
|
||||||
self.bold: str = "\033[1m"
|
self.bold = "\033[1m"
|
||||||
self.dim: str = "\033[2m"
|
self.dim = "\033[2m"
|
||||||
self.underline: str = "\033[4m"
|
self.underline = "\033[4m"
|
||||||
self.red: str = "\033[1;31m"
|
self.red = "\033[1;31m"
|
||||||
self.green: str = "\033[1;32m"
|
self.green = "\033[1;32m"
|
||||||
self.yellow: str = "\033[1;33m"
|
self.yellow = "\033[1;33m"
|
||||||
self.magenta: str = "\033[1;35m"
|
self.magenta = "\033[1;35m"
|
||||||
self.cyan: str = "\033[1;36m"
|
self.cyan = "\033[1;36m"
|
||||||
self.end: str = "\033[0m"
|
self.end = "\033[0m"
|
||||||
|
|
||||||
# for argparse help
|
# for argparse help
|
||||||
self.header: str = self.cyan
|
self.header = self.cyan
|
||||||
self.option: str = self.yellow
|
self.option = self.yellow
|
||||||
self.metavar: str = "\033[33m" # normal yellow
|
self.metavar = "\033[33m" # normal yellow
|
||||||
|
|
||||||
if not Env().force_color and (Env().no_color or not sys.stderr.isatty()):
|
if not Env().force_color and (Env().no_color or not sys.stderr.isatty()):
|
||||||
for attr in self.__dict__:
|
for attr in self.__dict__:
|
||||||
|
@ -1185,7 +1185,7 @@ def make_executable(path: Path) -> None:
|
||||||
def uses_viv(txt: str) -> bool:
|
def uses_viv(txt: str) -> bool:
|
||||||
return bool(
|
return bool(
|
||||||
re.search(
|
re.search(
|
||||||
"""
|
r"""
|
||||||
^(?!\#)\s*
|
^(?!\#)\s*
|
||||||
(?:__import__\(\s*["']viv["']\s*\))
|
(?:__import__\(\s*["']viv["']\s*\))
|
||||||
|
|
|
|
||||||
|
@ -1790,7 +1790,7 @@ class Viv:
|
||||||
run an app/script with an on-demand venv
|
run an app/script with an on-demand venv
|
||||||
|
|
||||||
examples:
|
examples:
|
||||||
viv r pycowsay -- "viv isn't venv\!"
|
viv r pycowsay -- "viv isn't venv\\!"
|
||||||
viv r rich -b python -- -m rich
|
viv r rich -b python -- -m rich
|
||||||
viv r -s <python script>
|
viv r -s <python script>
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue