diff --git a/Makefile b/Makefile index 2d3fb22..7b5c9a9 100644 --- a/Makefile +++ b/Makefile @@ -5,7 +5,7 @@ TEMPLATES := $(shell find src/ -type f) msgfmt = {a.style('==>','bold')} {a.style('$(1)','b_magenta')} {a.style('<==','bold')} msg = $(call tprint,$(call msgfmt ,$(1))) -### task.mk development | args: --divider --align center +### task.mk development | args: -d --align center -ms d_green ## bootstrap | generate local dev environment .PHONY: bootstrap bootstrap: @@ -42,7 +42,7 @@ c clean: @rm -f task.mk .task.mk ### | args: --divider --whitespace -### examples of task.mk features | args: --divider --align center +### examples of task.mk features | args: --divider --align center --msg-style d_red define list_files_py from pathlib import Path print("files in $(2)") diff --git a/src/help.py b/src/help.py index 9a41918..391d48b 100644 --- a/src/help.py +++ b/src/help.py @@ -24,6 +24,7 @@ def rawargs(argstring): parser.add_argument("--align") parser.add_argument("-d", "--divider", action="store_true") parser.add_argument("-ws", "--whitespace", action="store_true") + parser.add_argument("-ms", "--msg-style", type=str) return parser.parse_args(argstring.split()) @@ -57,15 +58,16 @@ def print_goal(goal, msg, max_goal_len): def print_rawmsg(msg, argstr, maxlens): args = rawargs(argstr) + msg_style = args.msg_style if args.msg_style else "$(MSG_COLOR)" if msg: if args.align == "sep": print( - f"{' '*(maxlens.goal+len('$(HELP_SEP)')+4)}{ansi.style(msg,'$(MSG_COLOR)')}" + f"{' '*(maxlens.goal+len('$(HELP_SEP)')+4)}{ansi.style(msg,msg_style)}" ) elif args.align == "center": - print(f" {ansi.style(msg.center(sum(maxlens)),'$(MSG_COLOR)')}") + print(f" {ansi.style(msg.center(sum(maxlens)),msg_style)}") else: - print(f" {ansi.style(msg,'$(MSG_COLOR)')}") + print(f" {ansi.style(msg,msg_style)}") if args.divider: print( ansi.style( diff --git a/task.mk b/task.mk index 8f72254..0d1da4f 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.12-8-gea398af-dev +# version: v22.9.12-9-g1bed53d-dev # # task.mk should be included at the bottom of your Makefile. # See below for the standard configuration options that should be set prior to including this file. @@ -119,6 +119,7 @@ def rawargs(argstring): parser.add_argument("--align") parser.add_argument("-d", "--divider", action="store_true") parser.add_argument("-ws", "--whitespace", action="store_true") + parser.add_argument("-ms", "--msg-style", type=str) return parser.parse_args(argstring.split()) @@ -152,15 +153,16 @@ def print_goal(goal, msg, max_goal_len): def print_rawmsg(msg, argstr, maxlens): args = rawargs(argstr) + msg_style = args.msg_style if args.msg_style else "$(MSG_COLOR)" if msg: if args.align == "sep": print( - f"{' '*(maxlens.goal+len('$(HELP_SEP)')+4)}{ansi.style(msg,'$(MSG_COLOR)')}" + f"{' '*(maxlens.goal+len('$(HELP_SEP)')+4)}{ansi.style(msg,msg_style)}" ) elif args.align == "center": - print(f" {ansi.style(msg.center(sum(maxlens)),'$(MSG_COLOR)')}") + print(f" {ansi.style(msg.center(sum(maxlens)),msg_style)}") else: - print(f" {ansi.style(msg,'$(MSG_COLOR)')}") + print(f" {ansi.style(msg,msg_style)}") if args.divider: print( ansi.style(