+
Skip to content

Add a way to customize the command signature #104

@gturpin-dev

Description

@gturpin-dev

Hi,

First, thanks for this awesome package 🎉

I was wondering if there's a way to customize the command signature in a way other than by just modifying its name. In some applications, you might prefer to create a command like ./minicli make:something, but I think that's not possible right now.

Another case could be adding hyphens in the command name. Currently, a command with multiple words results in a single stacked word. For example, if I want to create a PostTypeController, I would prefer to have ./minicli post-type instead of ./minicli posttype

After checking the documentation and some of the code, I don't believe there is a way to do that, am I correct ?
If so, do you think this could be a good enhancement ?

Looking at Laravel Artisan for example, there is a protected property "signature" in the command class that allow to overwrite the default name.
By default it can stay auto-generated from the classname, but it could be overwritten if the property is set for the current command or subcommand.

Here's an example with my post type example :

class PostTypeController extends CommandController {
    protected static ?string $signature = 'post-type';
}

And this will result of the command name changed from posttype to post-type only for the current scope.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载