poethepoet icon indicating copy to clipboard operation
poethepoet copied to clipboard

Passing arguments to subtask in sequence task seems to invalidate subtask def

Open wsascha opened this issue 2 years ago • 0 comments

Hey @nat-n, thanks again for your work, really appreciated! :heart:

This does not work for me:

[tool.poe.tasks.foo]
shell = "echo foo, ${arg}"
args = [{ name = "arg", positional = true, required = true }]

[tool.poe.tasks.bar]
sequence = ["foo ${arg}"]
args = [{ name = "arg", positional = true }]

When I call e.g. poe bar baz, I get

❯ poe bar baz
Traceback (most recent call last):
  File ".venv/bin/poe", line 8, in <module>
    sys.exit(main())
  File ".venv/lib/python3.8/site-packages/poethepoet/__init__.py", line 32, in main
    result = app(cli_args=sys.argv[1:])
  File ".venv/lib/python3.8/site-packages/poethepoet/app.py", line 45, in __call__
    self.config.validate()
  File ".venv/lib/python3.8/site-packages/poethepoet/config.py", line 176, in validate
    error = PoeTask.validate_def(task_name, task_def, self)
  File ".venv/lib/python3.8/site-packages/poethepoet/task/base.py", line 369, in validate_def
    task_type_issue = task_type._validate_task_def(
  File ".venv/lib/python3.8/site-packages/poethepoet/task/sequence.py", line 146, in _validate_task_def
    subtask_issue = cls.validate_def(
  File ".venv/lib/python3.8/site-packages/poethepoet/task/base.py", line 369, in validate_def
    task_type_issue = task_type._validate_task_def(
  File ".venv/lib/python3.8/site-packages/poethepoet/task/ref.py", line 56, in _validate_task_def
    referenced_task = config.tasks[task_ref]
KeyError: 'foo ${arg}'

Any idea what's going on? – Maybe I also use this the wrong way, but it seems pretty similar to the section on arguments for sequence tasks.

wsascha avatar Sep 01 '22 22:09 wsascha