feat: add command to generate a build file

Creates an initial `build.yaml` file based on the provided project name
and type.

Fixes #32
This commit is contained in:
Oliver Davies 2023-04-01 11:18:51 +01:00
parent eb01ae0790
commit 91e9da1454

View file

@ -20,6 +20,27 @@ use Twig\Loader\FilesystemLoader;
$app = new Application(); $app = new Application();
$app->command(
'generate-build-file [-p|--project-name=] [-t|--type=]',
function(
string $projectName,
string $type,
): void {
$projectName = str_replace('.', '-', $projectName);
// TODO: validate the project type.
$output = <<<EOF
name: $projectName
type: $type
EOF;
file_put_contents('build.yaml', $output);
}
)->descriptions('Generate a new build.yaml file.', [
'--project-name' => 'The name of the project.',
'--type' => 'The project type.',
]);;
$app->command( $app->command(
'run [-c|--config-file=] [-o|--output-dir=]', 'run [-c|--config-file=] [-o|--output-dir=]',
function ( function (
@ -110,8 +131,6 @@ $app->command(
'--output-dir' => 'The directory to create files in', '--output-dir' => 'The directory to create files in',
]); ]);
$app->setDefaultCommand('run');
$app->run(); $app->run();
/** /**