aboutsummaryrefslogtreecommitdiffstats
path: root/poetry_plugin_taskipy
diff options
context:
space:
mode:
authorEugene Triguba <eugenetriguba@gmail.com>2023-04-08 01:33:19 -0400
committerEugene Triguba <eugenetriguba@gmail.com>2023-04-08 01:33:19 -0400
commit596143799a21309db01619be52057ed1a696e6d5 (patch)
treeca5caf6482ee5ca692dfcda0d47349627a99b7c0 /poetry_plugin_taskipy
parentAdd pyproject.toml and poetry lockfile (diff)
downloadpoetry-plugin-taskipy2-596143799a21309db01619be52057ed1a696e6d5.zip
Add start of poetry plugin
Diffstat (limited to 'poetry_plugin_taskipy')
-rw-r--r--poetry_plugin_taskipy/__init__.py0
-rw-r--r--poetry_plugin_taskipy/commands.py31
-rw-r--r--poetry_plugin_taskipy/plugin.py10
3 files changed, 41 insertions, 0 deletions
diff --git a/poetry_plugin_taskipy/__init__.py b/poetry_plugin_taskipy/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/poetry_plugin_taskipy/__init__.py
diff --git a/poetry_plugin_taskipy/commands.py b/poetry_plugin_taskipy/commands.py
new file mode 100644
index 0000000..f4d8656
--- /dev/null
+++ b/poetry_plugin_taskipy/commands.py
@@ -0,0 +1,31 @@
+import taskipy
+from cleo.commands.command import Command
+from cleo.helpers import argument, option
+
+
+class TaskipyCommand(Command):
+ name = "task"
+ description = "taskipy - the complementary task runner for python"
+ options = [option("list", "l", "Show list of available tasks.")]
+ arguments = [
+ argument("name", "Name of the task.", optional=True),
+ argument(
+ "args",
+ "Arguments to pass to the task.",
+ optional=True,
+ multiple=True,
+ default=[],
+ ),
+ ]
+
+ def handle(self) -> int:
+ command = ""
+
+ if self.argument("name"):
+ command += self.argument("name")
+
+ if self.argument("args"):
+ command += " "
+ command += " ".join(self.argument("args"))
+
+ return taskipy.run(command)
diff --git a/poetry_plugin_taskipy/plugin.py b/poetry_plugin_taskipy/plugin.py
new file mode 100644
index 0000000..afd8d67
--- /dev/null
+++ b/poetry_plugin_taskipy/plugin.py
@@ -0,0 +1,10 @@
+from poetry.console.commands.command import Command
+from poetry.plugins.application_plugin import ApplicationPlugin
+
+from poetry_plugin_taskipy.commands import TaskipyCommand
+
+
+class TaskipyPlugin(ApplicationPlugin):
+ @property
+ def commands(self) -> list[type[Command]]:
+ return [TaskipyCommand]