zendframework / zend-expressive-tooling

Migration and development tooling for Expressive
BSD 3-Clause "New" or "Revised" License
32 stars 25 forks source link

Configurable default command options values #84

Closed arueckauer closed 5 years ago

arueckauer commented 5 years ago

It would be a nice feature, if default values for command options were configurable in a project and being used by zend-expressive-tooling if no explicit argument was provided.

In the following I will describe the case using the modules-path option for the module:create command. Other command options might benefit from the same implementation.

Let's say, we have a project, where the modules-path is not located in the default src but in custom-directory. Then modules-path could be configured as follows (just as an example - not sure, if that is a good option):

// In config/autoload/application.global.php:

<?php

declare(strict_types = 1);

use Zend\Expressive\Tooling\Module\CommandCommonOptions;

return [
    /* ... */
    CommandCommonOptions::class => [
        'modules_path' => 'custom-directory',
    ],
];

Then one could execute

./vendor/bin/expressive module:create MyModule

instead of needing to provide the modules-path each time

./vendor/bin/expressive module:create MyModule --modules-path custom-directory.

It should still be possible, to provide an option value overwriting the configured default:

./vendor/bin/expressive module:create MyModule --modules-path another-custom-directory.

mano87 commented 5 years ago

That would be a really nice option. Just do a PR :-)

arueckauer commented 5 years ago

This feature was released in 1.2.0.