Skip to content

Commit

Permalink
Ask fewer questions in project:create and variable:create forms
Browse files Browse the repository at this point in the history
  • Loading branch information
pjcdawkins committed Oct 12, 2022
1 parent 5d20d4f commit c1dfd11
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 12 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
16 changes: 8 additions & 8 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions src/Command/Project/ProjectCreateCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -411,13 +412,15 @@ 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',
'default' => 5,
'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)',
Expand Down
12 changes: 9 additions & 3 deletions src/Command/Variable/VariableCommandBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -225,13 +227,15 @@ function ($value) {
],
'description' => 'Whether the variable should be enabled',
'questionLine' => 'Should the variable be enabled?',
'avoidQuestion' => true,
]);
$fields['is_inheritable'] = new BooleanField('Inheritable', [
'conditions' => [
'level' => self::LEVEL_ENVIRONMENT,
],
'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',
Expand All @@ -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;
Expand Down

0 comments on commit c1dfd11

Please sign in to comment.