feat: add additional parameter syntax

This commit is contained in:
Daylin Morgan 2023-01-19 12:54:57 -06:00
parent 5c65cae578
commit 949c35e2a3
3 changed files with 48 additions and 7 deletions

View File

@ -5,8 +5,8 @@ TEMPLATES := $(shell find src/ -type f)
msg = $(if $(tprint),$(call tprint,{a.bold}==> {a.magenta}$(1){a.end}),@echo '==> $(1)')
### task.mk development | args: -d -ms b_green --align center
## bootstrap | generate local dev environment
### task.mk development |> -d -ms b_green --align center
## bootstrap | generate local dev environment |> -ms b_magenta -gs b_cyan
.PHONY: bootstrap env hooks
bootstrap: env hooks
env:
@ -17,6 +17,7 @@ hooks:
@git config core.hooksPath .githooks
docs-env:
@mamba run -p ./env pip install mkdocs-material mkdocs-git-revision-date-localized-plugin
## l, lint | lint the python
.PHONY: l lint
l lint:

View File

@ -20,8 +20,31 @@ a = ansi = Ansi(target="stdout")
MaxLens = namedtuple("MaxLens", "goal msg")
###- double dollar signs to prevent make escaping them -###
###- re.X requires all important whitespace is escaped -###
pattern = re.compile(
r"^## (?P<goal>.*?) \| (?P<msg>.*?)(?:\s?\| args: (?P<msgargs>.*?))?$$|^### (?P<rawmsg>.*?)?(?:\s?\| args: (?P<rawargs>.*?))?$$"
r"""
^\#\#\
(?P<goal>.*?)\s?\|\s?(?P<msg>.*?)
\s?
(?:
(?:\|\s?args:\s?|\|>)
\s?
(?P<msgargs>.*?)
)?
$$
|
^\#\#\#\
(?P<rawmsg>.*?)
\s?
(?:
(?:\|\s?args:|\|\>)
\s?
(?P<rawargs>.*?)
)?
$$
"""
,re.X
)
goal_pattern = re.compile(r"""^(?!#|\t)(.*):.*\n\t""", re.MULTILINE)

25
task.mk
View File

@ -1,7 +1,7 @@
# }> [github.com/daylinmorgan/task.mk] <{ #
# Copyright (c) 2022 Daylin Morgan
# MIT License
# version: v22.9.28-5-g83fe41d-dev
# version: v22.9.28-7-gfa977c4-dev
#
# 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.
@ -91,10 +91,27 @@ $(utils_py)
a = ansi = Ansi(target="stdout")
MaxLens = namedtuple("MaxLens", "goal msg")
pattern = re.compile(
r"""
^\#\#\ (?P<goal>.*?)\ \|\ (?P<msg>.*?)(?:\s?\|\ args:\ (?P<msgargs>.*?))?$$
r"""
^\#\#\
(?P<goal>.*?)\s?\|\s?(?P<msg>.*?)
\s?
(?:
(?:\|\s?args:\s?|\|>)
\s?
(?P<msgargs>.*?)
)?
$$
|
^\#\#\#\ (?P<rawmsg>.*?)?(?:\s?\|\ args:\ (?P<rawargs>.*?))?$$"""
^\#\#\#\
(?P<rawmsg>.*?)
\s?
(?:
(?:\|\s?args:|\|\>)
\s?
(?P<rawargs>.*?)
)?
$$
"""
,re.X
)
goal_pattern = re.compile(r"""^(?!#|\t)(.*):.*\n\t""", re.MULTILINE)