chore: linting

This commit is contained in:
Daylin Morgan 2022-09-21 10:12:15 -05:00
parent 071f7fc991
commit 5f593e35c8
2 changed files with 19 additions and 11 deletions

View file

@ -37,13 +37,15 @@ def gen_makefile():
return makefile return makefile
def parse_help(file,hidden=False): def parse_help(file, hidden=False):
for line in file.splitlines(): for line in file.splitlines():
match = pattern.search(line) match = pattern.search(line)
if match: if match:
if not hidden and not os.getenv("SHOW_HIDDEN") and str( if (
match.groupdict().get("goal") not hidden
).startswith("_"): and not os.getenv("SHOW_HIDDEN")
and str(match.groupdict().get("goal")).startswith("_")
):
pass pass
else: else:
yield {k: v for k, v in match.groupdict().items() if v is not None} yield {k: v for k, v in match.groupdict().items() if v is not None}
@ -51,7 +53,9 @@ def parse_help(file,hidden=False):
def recipe_help_header(goal): def recipe_help_header(goal):
item = [ item = [
i for i in list(parse_help(gen_makefile(),hidden=True)) if "goal" in i and goal == i["goal"] i
for i in list(parse_help(gen_makefile(), hidden=True))
if "goal" in i and goal == i["goal"]
] ]
if item: if item:
return fmt_goal( return fmt_goal(

16
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.19-3-g81a0031-dev # version: v22.9.19-4-g071f7fc-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.
@ -102,19 +102,23 @@ def gen_makefile():
with open(file, "r") as f: with open(file, "r") as f:
makefile += f.read() + "\n\n" makefile += f.read() + "\n\n"
return makefile return makefile
def parse_help(file,hidden=False): def parse_help(file, hidden=False):
for line in file.splitlines(): for line in file.splitlines():
match = pattern.search(line) match = pattern.search(line)
if match: if match:
if not hidden and not os.getenv("SHOW_HIDDEN") and str( if (
match.groupdict().get("goal") not hidden
).startswith("_"): and not os.getenv("SHOW_HIDDEN")
and str(match.groupdict().get("goal")).startswith("_")
):
pass pass
else: else:
yield {k: v for k, v in match.groupdict().items() if v is not None} yield {k: v for k, v in match.groupdict().items() if v is not None}
def recipe_help_header(goal): def recipe_help_header(goal):
item = [ item = [
i for i in list(parse_help(gen_makefile(),hidden=True)) if "goal" in i and goal == i["goal"] i
for i in list(parse_help(gen_makefile(), hidden=True))
if "goal" in i and goal == i["goal"]
] ]
if item: if item:
return fmt_goal( return fmt_goal(