mirror of
https://github.com/opdavies/build-configs.git
synced 2025-01-23 02:27:33 +00:00
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:
parent
eb01ae0790
commit
91e9da1454
|
@ -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();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue