Skip to content

[NFR] Custom commands feature #1518

Open
@BeMySlaveDarlin

Description

@BeMySlaveDarlin

Feature

Right now we have possibility to use custom scripts via \Phalcon\DevTools\Script::loadUserScripts(), but the way it done is outdated and legacy, requires usage of temp folder .phalcon

        if (!file_exists('.phalcon/project.ini')) {
            return;
        }

        $config = parse_ini_file('.phalcon/project.ini');

        if (!isset($config['scripts'])) {
            return;
        }

        foreach (explode(',', $config['scripts']) as $directory) {
            ...
        }

New point is to implement better and flexible behavior: for example
config.php

return [
    'database' => [
        ...
    ],
    'application' => [
        ...
    ],
    'commands' => [
        'my-custom-command' => MyCustomCommand::class,
    ],
];

Where MyCustomCommand implements \Phalcon\DevTools\Commands\CommandsInterface
And usage
user@server:/var/www/app$ phalcon my-custom-command --custom-option=1

This will require first to finish #1455

Why we need it?

Nowadays all of popular frameworks have extendable cli tools, which allows to make CI/CD much cleaner and easier.
It would be nice to have same scope in devtools

Metadata

Metadata

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions