laminas-cli icon indicating copy to clipboard operation
laminas-cli copied to clipboard

Remember previous answers

Open michalbundyra opened this issue 5 years ago • 1 comments

Feature Request

Q A
New Feature yes

Summary

As mentioned in https://github.com/laminas/laminas-cli/pull/20#issuecomment-638685075 I'd like to have an option to remember previous answers and reuse them in the future calls of the same commands.

I think it should work as follows:

  • all answers should be remembered somewhere and suggested on the next call od the command
  • it should work ONLY in interactive mode, so executing command in non-interactive mode will use default values (or values provided in options), but never remembered answers.

We might consider also another feature in that case: configure fixed values for parameters. What I mean by that, let say we have a command:

$ vendor/bin/laminas my-command --composer=<composer> --modules=<dir/to/modules/> ...

we might configure values for these parameters:

'laminas-cli' => [
    'parameters' => [
        'my-command' => [ // or the command class name 
            '--modules' => './modules',
            '--composer' => '/usr/local/bin/composer',
        ],
    ],
],

so executing command without options provided will use configured values before default values and question in interactive mode will be skipped. In non-interactive mode configured values should be used before default values.

michalbundyra avatar Jun 04 '20 20:06 michalbundyra

What convention to follow for configs? possibly 'src/configs/command-name.extension' Can be same storage format for answers as well? 'commandname-answers.extension'

its-leofisher avatar Jun 16 '20 19:06 its-leofisher