zfcampus / zf-console

Create console applications in PHP
BSD 3-Clause "New" or "Revised" License
64 stars 25 forks source link

Simplify mapping the command name to the route #5

Closed weierophinney closed 10 years ago

weierophinney commented 10 years ago

The command name could be prepended to the route provided:

    array(
        'name' => 'fetch-all',
        'route' => '[--output=]',
    )

would evaluate to:

    'fetch-all [--output=]'

This could even be such that you could opt-out if you wanted:

    array(
        'name' => 'version',
        'route' => '[--version|-v]'
        'prepend_command_to_route' => false,
    ),

Finally, if the route already starts with the command name, no changes would be made:

    array(
        'name' => 'fetch-all',
        'route' => 'fetch-all [--output=]',
    ),

The last ensures BC, the middle allows opting-out of the 1:1 mapping when desired, and the first removes redundancy for the most common use case.

The intention is to codify https://github.com/zfcampus/zf-console/commit/f82408249267d37cb5629c9066066d0172d6957f#diff-c9248b3167fc44af085b81db2e292837R136

weierophinney commented 10 years ago

Ping @slaff ... :)

slaff commented 10 years ago

@weierophinney Hooray! I would love to check this feature tomorrow, my time.

slaff commented 10 years ago

@weierophinney I just checked most of the features and they look good. And congratulations for the new release (https://github.com/zfcampus/zf-console/releases/tag/1.0.2)

weierophinney commented 10 years ago

@slaff I needed to tag it so that zf-deploy could pick up the changes so we could incorporate them. :)