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 ?=
DIVIDER_STYLE ?= default DIVIDER_STYLE ?= default
HELP_SEP ?= HELP_SEP ?=
WRAP ?= 100
# python f-string literals # python f-string literals
EPILOG ?= EPILOG ?=
USAGE ?={ansi.header}usage{ansi.end}:\n make <recipe>\n 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 # this is just to trick the LSP during development
from utils import ansi, cfg from utils import ansi, cfg
# -### # -###
@ -92,6 +91,7 @@ def get_goal_deps(goal="task.mk"):
if match and match.groups()[0]: if match and match.groups()[0]:
return wrap( return wrap(
f"{ansi.style('deps','default')}: {ansi.style(match.groups()[0].strip(),'msg')}", f"{ansi.style('deps','default')}: {ansi.style(match.groups()[0].strip(),'msg')}",
width=cfg.wrap,
initial_indent=" ", initial_indent=" ",
subsequent_indent=" ", subsequent_indent=" ",
) )

View file

@ -12,6 +12,7 @@ class Config:
sep: str sep: str
epilog: str epilog: str
usage: str usage: str
wrap: int
color2byte = dict( color2byte = dict(
@ -110,5 +111,6 @@ class Ansi:
a = ansi = 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 %# #% endblock %#