pydoit / doit

task management & automation tool

Home Page:http://pydoit.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Commands don't work when DB file option is specified?

jglogan opened this issue · comments

dodo.py:

def task_hello():
    return {
        'doc': 'Print something.',
        'actions': [ 'echo Hello, world!' ]
    }

What I see:

% doit -f dodo.py list
hello   Print something.
% doit --db-file ${PWD}/doit-test.db -f dodo.py list
ERROR: Invalid parameter: "list". Must be a command, task, or a target.
Type "doit help" to see available commands.
Type "doit list" to see available tasks.

Is this expected behavior?

Environment

  1. OS: MacOS 12.3.1
  2. python version: 3.9.9
  3. doit version: 0.34.2

Upvote & Fund

  • We're using Polar.sh so you can upvote and help fund this issue.
  • We receive the funding once the issue is completed & confirmed by you.
  • Thank you in advance for helping prioritize & fund our backlog.
Fund with Polar

Only task-loader options can be specified before a sub-command (i.e. list).
Moving the option after the list should work.

doit  -f dodo.py list --db-file ${PWD}/doit-test.db

Sorry, documentation on this really needs some improvements...

I was confused because I thought I'd need to handle subcommands separately from tasks, as I was using doit task-name to dispatch tasks. But, with doit run task-name I can apply the argument consistently. Thank you for your help!

Note that parsing CLI options is strict as not accepting unrecognized options.
Configurations are more flexible in this aspect. You can specify an option to all commands, and those are options are ignored if they do not apply.

dodo.py

DOIT_CONFIG = {"dep_file": "doit-test.db"}