pydoit/doit

Creating commands as described in the docs does not work

mlell opened this issue · 2 comments

mlell commented

I tried to implement the directions shown in the docs on how to create a new command for doit.

The docs say:

To create a new command, subclass doit.cmd_base.
Command set some class variables and implement the execute method.

Below is my example dodo.py file. I copied it verbatim from the docs:

from doit.cmd_base import Command

class Init(Command):
    doc_purpose = 'create a project scaffolding'
    doc_usage = ''
    doc_description = """This is a multiline command description.
It will be displayed on `doit help init`"""

    def execute(self, opt_values, pos_args):
        print("TODO: create some files for my project")

After saving, the file, I executed doit Init.

Expected behaviour: Output TODO: create some files for my project is printed

Actual behaviour: Output ERROR: Invalid parameter: "Init". Must be a command, task, or a target.

Environment

  1. OS: Debian
  2. python version: 3.9.2
  3. doit version: 0.33.1

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

Keep reading the docs... you need to register the command as a plugin...

mlell commented

I see, thanks