diff --git a/Processor.php b/Processor.php
index 6dc208f..7e5c054 100644
--- a/Processor.php
+++ b/Processor.php
@@ -104,7 +104,7 @@ private function processParams(array $config, array $expectedParams, array $actu
// Add the params coming from the environment values
$actualParams = array_replace($actualParams, $this->getEnvValues($envMap));
- return $this->getParams($expectedParams, $actualParams);
+ return $this->getParams($expectedParams, $actualParams, $config);
}
private function getEnvValues(array $envMap)
@@ -137,7 +137,7 @@ private function processRenamedValues(array $renameMap, array $actualParams)
return $actualParams;
}
- private function getParams(array $expectedParams, array $actualParams)
+ private function getParams(array $expectedParams, array $actualParams, array $config = array())
{
// Simply use the expectedParams value as default for the missing params.
if (!$this->io->isInteractive()) {
@@ -153,7 +153,11 @@ private function getParams(array $expectedParams, array $actualParams)
if (!$isStarted) {
$isStarted = true;
- $this->io->write('Some parameters are missing. Please provide them.');
+ if (empty($config['comment'])) {
+ $this->io->write('Some parameters are missing. Please provide them.');
+ } else {
+ $this->io->write(sprintf('%s', $config['comment']));
+ }
}
$default = Inline::dump($message);
diff --git a/Tests/ProcessorTest.php b/Tests/ProcessorTest.php
index babf44a..f3b36a7 100644
--- a/Tests/ProcessorTest.php
+++ b/Tests/ProcessorTest.php
@@ -151,7 +151,11 @@ private function setInteractionExpectations(array $testCase)
}
if (!empty($testCase['requested_params'])) {
- $this->io->write('Some parameters are missing. Please provide them.')->shouldBeCalledTimes(1);
+ if (empty($testCase['config']['comment'])) {
+ $this->io->write('Some parameters are missing. Please provide them.')->shouldBeCalledTimes(1);
+ } else {
+ $this->io->write(sprintf('%s', $testCase['config']['comment']))->shouldBeCalledTimes(1);
+ }
}
foreach ($testCase['requested_params'] as $param => $settings) {
diff --git a/Tests/fixtures/testcases/interaction_existent_with_comment/dist.yml b/Tests/fixtures/testcases/interaction_existent_with_comment/dist.yml
new file mode 100644
index 0000000..4134d19
--- /dev/null
+++ b/Tests/fixtures/testcases/interaction_existent_with_comment/dist.yml
@@ -0,0 +1,4 @@
+parameters:
+ foo: bar
+ boolean: false
+ another: ~
diff --git a/Tests/fixtures/testcases/interaction_existent_with_comment/existing.yml b/Tests/fixtures/testcases/interaction_existent_with_comment/existing.yml
new file mode 100644
index 0000000..c31530c
--- /dev/null
+++ b/Tests/fixtures/testcases/interaction_existent_with_comment/existing.yml
@@ -0,0 +1,3 @@
+# This file is auto-generated during the composer install
+parameters:
+ foo: existing_foo
diff --git a/Tests/fixtures/testcases/interaction_existent_with_comment/expected.yml b/Tests/fixtures/testcases/interaction_existent_with_comment/expected.yml
new file mode 100644
index 0000000..73f278e
--- /dev/null
+++ b/Tests/fixtures/testcases/interaction_existent_with_comment/expected.yml
@@ -0,0 +1,5 @@
+# This file is auto-generated during the composer install
+parameters:
+ foo: existing_foo
+ boolean: false
+ another: 'null'
diff --git a/Tests/fixtures/testcases/interaction_existent_with_comment/setup.yml b/Tests/fixtures/testcases/interaction_existent_with_comment/setup.yml
new file mode 100644
index 0000000..3884911
--- /dev/null
+++ b/Tests/fixtures/testcases/interaction_existent_with_comment/setup.yml
@@ -0,0 +1,14 @@
+title: Existing values are not asked interactively again
+
+interactive: true
+
+config:
+ comment: 'Please provide your configuration parameters'
+
+requested_params:
+ boolean:
+ default: 'false'
+ input: 'false'
+ another:
+ default: 'null'
+ input: '"null"'
diff --git a/Tests/fixtures/testcases/interaction_non_existent_with_comment/dist.yml b/Tests/fixtures/testcases/interaction_non_existent_with_comment/dist.yml
new file mode 100644
index 0000000..c6e5b2c
--- /dev/null
+++ b/Tests/fixtures/testcases/interaction_non_existent_with_comment/dist.yml
@@ -0,0 +1,4 @@
+parameters:
+ boolean: false
+ another: test
+ nested: nested
diff --git a/Tests/fixtures/testcases/interaction_non_existent_with_comment/expected.yml b/Tests/fixtures/testcases/interaction_non_existent_with_comment/expected.yml
new file mode 100644
index 0000000..84b8ddd
--- /dev/null
+++ b/Tests/fixtures/testcases/interaction_non_existent_with_comment/expected.yml
@@ -0,0 +1,10 @@
+# This file is auto-generated during the composer install
+parameters:
+ boolean: true
+ another: null
+ nested:
+ foo: bar
+ bar:
+ - foo
+ - test
+ - null
diff --git a/Tests/fixtures/testcases/interaction_non_existent_with_comment/setup.yml b/Tests/fixtures/testcases/interaction_non_existent_with_comment/setup.yml
new file mode 100644
index 0000000..28b0ac0
--- /dev/null
+++ b/Tests/fixtures/testcases/interaction_non_existent_with_comment/setup.yml
@@ -0,0 +1,17 @@
+title: Missing keys are asked interactively
+
+interactive: true
+
+config:
+ comment: 'Please provide your configuration parameters'
+
+requested_params:
+ boolean:
+ default: 'false'
+ input: 'true'
+ nested:
+ default: nested
+ input: '{foo: bar, bar: [foo, test, null]}'
+ another:
+ default: test
+ input: 'null'