chore: rename commands

- Renamed `generate-build-file` to `init` as it's initialising a new
  project.
- Renamed `run` to `generate` as it's generating the configuration
  files.
This commit is contained in:
Oliver Davies 2023-04-21 11:51:27 +01:00
parent 02c8b41194
commit 27ce1dc100

View file

@ -24,9 +24,10 @@ use Twig\Loader\FilesystemLoader;
$app = new Application(); $app = new Application();
$app->command( $app->command(
'generate-build-file [-p|--project-name=] [-t|--type=]', 'init [-p|--project-name=] [-l|--language=] [-t|--type=]',
function( function(
string $projectName, string $projectName,
string $language,
string $type, string $type,
): void { ): void {
$projectName = str_replace('.', '-', $projectName); $projectName = str_replace('.', '-', $projectName);
@ -34,18 +35,20 @@ $app->command(
// TODO: validate the project type. // TODO: validate the project type.
$output = <<<EOF $output = <<<EOF
name: $projectName name: $projectName
language: $language
type: $type type: $type
EOF; EOF;
file_put_contents('build.yaml', $output); file_put_contents('build.yaml', $output);
} }
)->descriptions('Generate a new build.yaml file.', [ )->descriptions('Initialise a new build.yaml file.', [
'--project-name' => 'The name of the project.', '--project-name' => 'The name of the project.',
'--language' => 'The language used in the project.',
'--type' => 'The project type.', '--type' => 'The project type.',
]);; ]);;
$app->command( $app->command(
'run [-c|--config-file=] [-o|--output-dir=]', 'generate [-c|--config-file=] [-o|--output-dir=]',
function ( function (
SymfonyStyle $io, SymfonyStyle $io,
string $configFile = 'build.yaml', string $configFile = 'build.yaml',