pydoit / doit

CLI task management & automation tool
http://pydoit.org
MIT License
1.85k stars 175 forks source link

Creating commands as described in the docs does not work #414

Closed mlell closed 2 years ago

mlell commented 2 years ago

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

Fund with Polar

schettino72 commented 2 years ago

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

mlell commented 2 years ago

I see, thanks