From 5eb3e21b51b1c257836e8826b028b82795966f77 Mon Sep 17 00:00:00 2001 From: Daylin Morgan Date: Wed, 14 Sep 2022 00:06:25 -0500 Subject: [PATCH] feat: make divider configurable --- src/config.mk | 1 + src/help.py | 5 +++-- task.mk | 8 +++++--- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/config.mk b/src/config.mk index 4fba464..16a752a 100644 --- a/src/config.mk +++ b/src/config.mk @@ -5,6 +5,7 @@ ACCENT_COLOR ?= b_yellow GOAL_COLOR ?= $(ACCENT_COLOR) MSG_COLOR ?= faint DIVIDER_COLOR ?= default +DIVIDER ?= ─ HELP_SEP ?= | # python f-string literals diff --git a/src/help.py b/src/help.py index 7fb0b93..3cc10d4 100644 --- a/src/help.py +++ b/src/help.py @@ -23,7 +23,7 @@ def rawargs(argstring): parser = argparse.ArgumentParser() parser.add_argument("-a", "--align") parser.add_argument("-d", "--divider", action="store_true") - parser.add_argument("-ws","--whitespace",action="store_true") + parser.add_argument("-ws", "--whitespace", action="store_true") return parser.parse_known_args(argstring.split()) @@ -69,7 +69,8 @@ def print_rawmsg(msg, argstr, maxlens): if args.divider: print( ansi.style( - f" {'─'*(len('$(HELP_SEP)')+sum(maxlens)+2)}", "$(DIVIDER_COLOR)" + f" {'$(DIVIDER)'*(len('$(HELP_SEP)')+sum(maxlens)+2)}", + "$(DIVIDER_COLOR)", ) ) if args.whitespace: diff --git a/task.mk b/task.mk index 7fab46d..1c3c63d 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-4-g037e474-dev +# version: v22.9.12-6-gf9cb3f6-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. @@ -14,6 +14,7 @@ ACCENT_COLOR ?= b_yellow GOAL_COLOR ?= $(ACCENT_COLOR) MSG_COLOR ?= faint DIVIDER_COLOR ?= default +DIVIDER ?= ─ HELP_SEP ?= | # python f-string literals @@ -117,7 +118,7 @@ def rawargs(argstring): parser = argparse.ArgumentParser() parser.add_argument("-a", "--align") parser.add_argument("-d", "--divider", action="store_true") - parser.add_argument("-ws","--whitespace",action="store_true") + parser.add_argument("-ws", "--whitespace", action="store_true") return parser.parse_known_args(argstring.split()) @@ -163,7 +164,8 @@ def print_rawmsg(msg, argstr, maxlens): if args.divider: print( ansi.style( - f" {'─'*(len('$(HELP_SEP)')+sum(maxlens)+2)}", "$(DIVIDER_COLOR)" + f" {'$(DIVIDER)'*(len('$(HELP_SEP)')+sum(maxlens)+2)}", + "$(DIVIDER_COLOR)", ) ) if args.whitespace: