diff --git a/src/help.py b/src/help.py index 48b7664..4b67f39 100644 --- a/src/help.py +++ b/src/help.py @@ -23,17 +23,17 @@ MaxLens = namedtuple("MaxLens", "goal msg") pattern = re.compile( r""" (?: - ^\#\#\#\s+ + ^\#\#\#\s+ # <- raw message | ^(?: (?:\#\#\s+)? (?P.*?)(?:\s+\|>|:.*?\#\#)\s+ - ) + ) # <- a custom goal or actual recipe ) -(?P.*?)?\s? +(?P.*?)?\s? # <- help text (optional) (?:\|>\s+ (?P.*?) -)? +)? # <- style args (optional) $$ """, re.X, diff --git a/src/print.py b/src/print.py index cfbb551..92b0789 100644 --- a/src/print.py +++ b/src/print.py @@ -3,5 +3,6 @@ #% block script %# ##- '$(utils_py)' -## ###- sys is imported with utils_py -### +###- $(2) f-string from task.mk -### sys.stderr.write(f"""$(2)\n""") #% endblock %# diff --git a/src/utils.py b/src/utils.py index e504c4f..0924352 100644 --- a/src/utils.py +++ b/src/utils.py @@ -96,7 +96,7 @@ class Ansi: sys.exit(1) return code + end - + ###- the below $() variables are injected by make -### def add_cfg(self): cfg_styles = { "header": "$(HEADER_STYLE)", @@ -118,6 +118,7 @@ class Ansi: a = ansi = Ansi() +###- the below $() variables are injected by make -### cfg = Config( "$(DIVIDER)", "$(HELP_SEP)", f"""$(EPILOG)""", f"""$(USAGE)""", int("$(WRAP)") ) diff --git a/task.mk b/task.mk index 32f726f..c2224d7 100644 --- a/task.mk +++ b/task.mk @@ -1,7 +1,7 @@ # }> [github.com/daylinmorgan/task.mk] <{ # # Copyright (c) 2022 Daylin Morgan # MIT License -# version: v22.9.28-16-g920c7c2dev +# version: v22.9.28-17-g365e0e1dev # # task.mk should be included at the bottom of your Makefile with `-include .task.mk` # See below for the standard configuration options that should be set prior to including this file. @@ -90,17 +90,17 @@ MaxLens = namedtuple("MaxLens", "goal msg") pattern = re.compile( r""" (?: - ^\#\#\#\s+ + ^\#\#\#\s+ # <- raw message | ^(?: (?:\#\#\s+)? (?P.*?)(?:\s+\|>|:.*?\#\#)\s+ - ) + ) # <- a custom goal or actual recipe ) -(?P.*?)?\s? +(?P.*?)?\s? # <- help text (optional) (?:\|>\s+ (?P.*?) -)? +)? # <- style args (optional) $$ """, re.X, @@ -391,6 +391,7 @@ class Ansi: print("Expected one or three values for bg as a list") sys.exit(1) return code + end + def add_cfg(self): cfg_styles = { "header": "$(HEADER_STYLE)",