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

View file

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

23
task.mk
View file

@ -1,7 +1,7 @@
# }> [github.com/daylinmorgan/task.mk] <{ # # }> [github.com/daylinmorgan/task.mk] <{ #
# Copyright (c) 2022 Daylin Morgan # Copyright (c) 2022 Daylin Morgan
# MIT License # 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` # 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. # See below for the standard configuration options that should be set prior to including this file.
@ -92,9 +92,26 @@ a = ansi = Ansi(target="stdout")
MaxLens = namedtuple("MaxLens", "goal msg") MaxLens = namedtuple("MaxLens", "goal msg")
pattern = re.compile( pattern = re.compile(
r""" r"""
^\#\#\ (?P<goal>.*?)\ \|\ (?P<msg>.*?)(?:\s?\|\ args:\ (?P<msgargs>.*?))?$$ ^\#\#\
(?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 ,re.X
) )
goal_pattern = re.compile(r"""^(?!#|\t)(.*):.*\n\t""", re.MULTILINE) goal_pattern = re.compile(r"""^(?!#|\t)(.*):.*\n\t""", re.MULTILINE)