From c1dfd11ca9e6756d932cf990bac7256962d21b49 Mon Sep 17 00:00:00 2001 From: Patrick Dawkins Date: Mon, 13 Jun 2022 14:18:53 +0100 Subject: [PATCH] Ask fewer questions in project:create and variable:create forms --- composer.json | 2 +- composer.lock | 16 ++++++++-------- src/Command/Project/ProjectCreateCommand.php | 3 +++ src/Command/Variable/VariableCommandBase.php | 12 +++++++++--- 4 files changed, 21 insertions(+), 12 deletions(-) diff --git a/composer.json b/composer.json index c8c7825473..05ba5063c2 100644 --- a/composer.json +++ b/composer.json @@ -7,7 +7,7 @@ "doctrine/cache": "~1.5", "guzzlehttp/guzzle": "^5.3", "guzzlehttp/ringphp": "^1.1", - "platformsh/console-form": ">=0.0.29 <2.0", + "platformsh/console-form": ">=0.0.31 <2.0", "platformsh/client": ">=0.65.0 <2.0", "symfony/console": "^3.0 >=3.2", "symfony/yaml": "^3.0 || ^2.6", diff --git a/composer.lock b/composer.lock index 2eac4098ec..d7ba4dc7fc 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "34d58d4d60b6a7dc88d01b5673969e9c", + "content-hash": "158e4a581e92f2d0c1e3000ef4027ffe", "packages": [ { "name": "cocur/slugify", @@ -778,21 +778,21 @@ }, { "name": "platformsh/console-form", - "version": "v0.0.29", + "version": "v0.0.32", "source": { "type": "git", "url": "https://github.com/platformsh/console-form.git", - "reference": "67f046343000718f92d4d181147aa53abd6a2419" + "reference": "d8f14e280a75098997cdfc562ae95392c7ee02f9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/platformsh/console-form/zipball/67f046343000718f92d4d181147aa53abd6a2419", - "reference": "67f046343000718f92d4d181147aa53abd6a2419", + "url": "https://api.github.com/repos/platformsh/console-form/zipball/d8f14e280a75098997cdfc562ae95392c7ee02f9", + "reference": "d8f14e280a75098997cdfc562ae95392c7ee02f9", "shasum": "" }, "require": { "php": ">=5.5.9", - "symfony/console": "^4.0 || ^3.0 || ^2.6" + "symfony/console": "^6.0 || ^5.0 || ^4.0 || ^3.0 || ^2.6" }, "require-dev": { "phpunit/phpunit": "^5.0" @@ -815,9 +815,9 @@ "description": "A lightweight Symfony Console form system.", "support": { "issues": "https://github.com/platformsh/console-form/issues", - "source": "https://github.com/platformsh/console-form/tree/v0.0.29" + "source": "https://github.com/platformsh/console-form/tree/v0.0.32" }, - "time": "2022-05-11T12:31:03+00:00" + "time": "2022-09-23T10:13:34+00:00" }, { "name": "psr/container", diff --git a/src/Command/Project/ProjectCreateCommand.php b/src/Command/Project/ProjectCreateCommand.php index 861144d04f..64cdee1395 100644 --- a/src/Command/Project/ProjectCreateCommand.php +++ b/src/Command/Project/ProjectCreateCommand.php @@ -403,6 +403,7 @@ protected function getFields(SetupOptions $setupOptions = null) }, 'default' => in_array('development', $this->getAvailablePlans(false, $setupOptions)) ? 'development' : null, 'allowOther' => true, + 'avoidQuestion' => true, ]), 'environments' => new Field('Environments', [ 'optionName' => 'environments', @@ -411,6 +412,7 @@ protected function getFields(SetupOptions $setupOptions = null) 'validator' => function ($value) { return is_numeric($value) && $value > 0 && $value < 50; }, + 'avoidQuestion' => true, ]), 'storage' => new Field('Storage', [ 'description' => 'The amount of storage per environment, in GiB', @@ -418,6 +420,7 @@ protected function getFields(SetupOptions $setupOptions = null) 'validator' => function ($value) { return is_numeric($value) && $value > 0 && $value < 1024; }, + 'avoidQuestion' => true, ]), 'default_branch' => new Field('Default branch', [ 'description' => 'The default Git branch name for the project (the production environment)', diff --git a/src/Command/Variable/VariableCommandBase.php b/src/Command/Variable/VariableCommandBase.php index f1bf220f6e..9cb2ca379c 100644 --- a/src/Command/Variable/VariableCommandBase.php +++ b/src/Command/Variable/VariableCommandBase.php @@ -195,14 +195,16 @@ function ($value) { 'description' => "The variable's value", ]); $fields['is_json'] = new BooleanField('JSON', [ - 'description' => 'Whether the variable is JSON-formatted', - 'questionLine' => 'Is the value JSON-formatted', + 'description' => 'Whether the variable value is JSON-formatted', + 'questionLine' => 'Is the value JSON-formatted?', 'default' => false, + 'avoidQuestion' => true, ]); $fields['is_sensitive'] = new BooleanField('Sensitive', [ - 'description' => 'Whether the variable is sensitive', + 'description' => 'Whether the variable value is sensitive', 'questionLine' => 'Is the value sensitive?', 'default' => false, + 'avoidQuestion' => true, ]); $fields['prefix'] = new OptionsField('Prefix', [ 'description' => "The variable name's prefix", @@ -225,6 +227,7 @@ function ($value) { ], 'description' => 'Whether the variable should be enabled', 'questionLine' => 'Should the variable be enabled?', + 'avoidQuestion' => true, ]); $fields['is_inheritable'] = new BooleanField('Inheritable', [ 'conditions' => [ @@ -232,6 +235,7 @@ function ($value) { ], 'description' => 'Whether the variable is inheritable by child environments', 'questionLine' => 'Is the variable inheritable (by child environments)?', + 'avoidQuestion' => true, ]); $fields['visible_build'] = new BooleanField('Visible at build time', [ 'optionName' => 'visible-build', @@ -243,11 +247,13 @@ function ($value) { // This defaults to true for project-level variables, false otherwise. return isset($values['level']) && $values['level'] === self::LEVEL_PROJECT; }, + 'avoidQuestion' => true, ]); $fields['visible_runtime'] = new BooleanField('Visible at runtime', [ 'optionName' => 'visible-runtime', 'description' => 'Whether the variable should be visible at runtime', 'questionLine' => 'Should the variable be available at runtime?', + 'avoidQuestion' => true, ]); return $fields;