pydoit/doit

task_params does not work when using basename

frozax opened this issue · 1 comments

Hi,

The task_params decorator does not work when the task is using basename. The parameters are detected, but not replaced in the task parameter in python.

dodo.py

from doit import task_params

@task_params([{"name": "param", "short": "p", "long": "param", "default": "default"}])
def task_test1(param):
    return { 'actions':[f"echo task_test1 {param}"] }

@task_params([{"name": "param", "short": "p", "long": "param", "default": "default"}])
def task_test2(param):
    return { 'basename': 'test_other', 'actions':[f"echo task_test2 {param}"] }

Execution

> doit -v2 test1 --param p1 test_other --param p2
.  test1
task_test1 p1
.  test_other
task_test2 default

Execution 2

> doit -v2 test_other --invalid p2
ERROR: Error parsing Task: option --invalid not recognized (parsing options: [CmdOption({'name':'param', 'short':'p','long':'param' })]). Got: ['--invalid', 'p2']

Environment

  1. OS: Windows 10
  2. python version: 3.7.3
  3. doit version: 0.34.2
Fund with Polar