aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEugene Triguba <eugenetriguba@gmail.com>2023-04-22 22:24:48 -0400
committerEugene Triguba <eugenetriguba@gmail.com>2023-04-22 22:24:48 -0400
commit3044d57606316fca600d0433e1b4bed6bb66e030 (patch)
tree8127c3c0e25efb88672b7149c8a09e247e224879
parentUse poetry plugin branch of taskipy (diff)
downloadpoetry-plugin-taskipy2-3044d57606316fca600d0433e1b4bed6bb66e030.zip
Add proper handling of poetry global directory option
-rw-r--r--poetry_plugin_taskipy/commands.py16
1 files changed, 11 insertions, 5 deletions
diff --git a/poetry_plugin_taskipy/commands.py b/poetry_plugin_taskipy/commands.py
index 4e80fd8..8b9e837 100644
--- a/poetry_plugin_taskipy/commands.py
+++ b/poetry_plugin_taskipy/commands.py
@@ -1,6 +1,8 @@
-import taskipy
+import pathlib
+
from cleo.commands.command import Command
from cleo.helpers import argument, option
+from taskipy import cli as taskipy_cli
class TaskipyCommand(Command):
@@ -21,13 +23,17 @@ class TaskipyCommand(Command):
def handle(self) -> int:
arguments = []
+ cwd = pathlib.Path.cwd()
+ if self.option("directory"):
+ cwd = pathlib.Path(self.option("directory")).resolve()
+
+ if self.option("list"):
+ arguments.append("--list")
+
if self.argument("name"):
arguments.append(self.argument("name"))
if self.argument("args"):
arguments.extend(self.argument("args"))
- if self.option("list"):
- arguments.append("--list")
-
- return taskipy.run(arguments)
+ return taskipy_cli.run(arguments, cwd=cwd)