Skip to content

Opt-in wrapping for 3rd party commands #25

@michalbundyra

Description

@michalbundyra

Feature Request

Q A
New Feature yes

Summary

Suggested before in #20 (comment).

As we would like provide integration layer with many libraries where console commands are already implemented (lets consider for example doctrine-migrations) we might want provide additional 'opt-in wrapping' so these commands can behave the same way as our commands - in case of input params and interactive mode.

In general it shouldn't be difficult to accomplish as long as we have array parameters (multiple values) - see #23 and command does have unique names for arguments and options.

In case command use the same name for argument and option, we may want provide additional mapping for parameter names, for example:

my-command <name> --name=<opt-name>

the configuration will be something like:

'laminas-cli' => [
    'wrapped' => [
        'my-command' => [ // or command class name
            'name' => '--arg-name',
            '--name' => '--opt-name',
        ],
    ],
],

when mapping is not provided the same names will be used, but arguments will be converted to options.

Because of this wrapping provided options of parameters can be passed to commands in chains.
Also we have consistent interface for all commands in laminas-cli.

EDIT:

As I am thinking about it more, probably we would need a bit more extended configuration. In the options/arguments mapping we would need provide also what input param type we want to use, maybe also if the parameter should be required.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions