From 209e2a86b8a7e8ec42a65b5dd4ca186308b52a3f Mon Sep 17 00:00:00 2001 From: Haseeb Majid Date: Sat, 25 Nov 2023 10:15:38 +0000 Subject: [PATCH] add possible taskfile locations --- src/mk/tools/taskfile.py | 33 +++++++++++++++++++++++---------- 1 file changed, 23 insertions(+), 10 deletions(-) diff --git a/src/mk/tools/taskfile.py b/src/mk/tools/taskfile.py index 8b915be..3ec9725 100644 --- a/src/mk/tools/taskfile.py +++ b/src/mk/tools/taskfile.py @@ -20,16 +20,29 @@ def __init__(self, path=".") -> None: self.executable = "" def is_present(self, path: Path) -> bool: - if os.path.isfile(os.path.join(path, "taskfile.yml")): - # On some Linux distros might be exposed as taskfile in order to - # avoid clashing with the other Task Warrior executable https://taskwarrior.org/ - self.executable = shutil.which("taskfile") or shutil.which("task") or "" - if not self.executable: - logging.error( - "taskfile.yml config found but the tool is not installed. See https://taskfile.dev/installation/", - ) - sys.exit(1) - return True + valid_taskfiles = [ + "Taskfile.yml" + "taskfile.yml" + "Taskfile.yaml" + "taskfile.yaml" + "Taskfile.dist.yml" + "taskfile.dist.yml" + "Taskfile.dist.yaml" + "taskfile.dist.yaml", + ] + + for taskfile in valid_taskfiles: + if os.path.isfile(os.path.join(path, taskfile)): + # On some Linux distros might be exposed as taskfile in order to + # avoid clashing with the other Task Warrior executable https://taskwarrior.org/ + self.executable = shutil.which(taskfile) or shutil.which("task") or "" + if not self.executable: + logging.error( + "%s config found but the tool is not installed. See https://taskfile.dev/installation/", + taskfile, + ) + sys.exit(1) + return True return False def actions(self) -> list[Action]: