feat: make textwrapping for deps configurable

This commit is contained in:
Daylin Morgan 2022-09-24 17:34:31 -05:00
parent 3defee72dc
commit 401eb1088b
3 changed files with 5 additions and 2 deletions

View file

@ -7,6 +7,7 @@ MSG_STYLE ?= faint
DIVIDER ?=
DIVIDER_STYLE ?= default
HELP_SEP ?=
WRAP ?= 100
# python f-string literals
EPILOG ?=
USAGE ?={ansi.header}usage{ansi.end}:\n make <recipe>\n

View file

@ -13,7 +13,6 @@ from textwrap import wrap
###-
# this is just to trick the LSP during development
from utils import ansi, cfg
# -###
@ -92,6 +91,7 @@ def get_goal_deps(goal="task.mk"):
if match and match.groups()[0]:
return wrap(
f"{ansi.style('deps','default')}: {ansi.style(match.groups()[0].strip(),'msg')}",
width=cfg.wrap,
initial_indent=" ",
subsequent_indent=" ",
)

View file

@ -12,6 +12,7 @@ class Config:
sep: str
epilog: str
usage: str
wrap: int
color2byte = dict(
@ -110,5 +111,6 @@ class Ansi:
a = ansi = Ansi()
cfg = Config("$(DIVIDER)", "$(HELP_SEP)", f"""$(EPILOG)""", f"""$(USAGE)""")
cfg = Config(
"$(DIVIDER)", "$(HELP_SEP)", f"""$(EPILOG)""", f"""$(USAGE)""",int('$(WRAP)'))
#% endblock %#