Skip to content

Commit

Permalink
Restyling output for Sync Model command
Browse files Browse the repository at this point in the history
  • Loading branch information
roberto-butti committed Apr 12, 2024
1 parent 20f98ae commit 5d27831
Showing 1 changed file with 22 additions and 7 deletions.
29 changes: 22 additions & 7 deletions src/Console/Commands/SyncModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,17 +53,23 @@ class SyncModel extends GeneratorCommand
*/
public function handle(): int
{

$this->output->title('Sync Model');
$markdownPath = $this->option('path');
$createModel = $this->option('create-model');

if (is_null($markdownPath)) {
$markdownPath = resource_path('content/article');
}

$this->info('Parsing the Markdown Directory: '.$markdownPath);
$this->components->twoColumnDetail(
'<info>Parsing the Markdown Directory</info>',
sprintf('<info>%s</info>', $markdownPath));

$modelName = basename($markdownPath);
$this->info('Folder Markdown Name: '.$modelName);

$this->components->twoColumnDetail(
'<info>Folder Markdown Name</info>',
sprintf('<info>%s</info>', $modelName));

if (! is_dir($markdownPath)) {
$this->error(sprintf('The Folder %s does not exist!', $markdownPath));
Expand Down Expand Up @@ -92,11 +98,20 @@ public function handle(): int
}

$this->modelName = Str::studly($modelName);
$this->info('Model Name : '.$this->modelName.'');
$this->components->twoColumnDetail(
'<info>Model Name</info>',
sprintf('<info>%s</info>', $this->modelName));

$this->output->newLine();
$this->frontmatterFields = '"'.implode('","', $collectedFields).'"';
$this->info('In the frontmatterFields method you have to return: '.
$this->frontmatterFields.
'');
$this->components->twoColumnDetail(
'<info>In the frontmatterFields() method you have to return:</info>',
''
);
$this->components->twoColumnDetail(
'',
$this->frontmatterFields
);

if ($createModel) {
parent::handle();
Expand Down

0 comments on commit 5d27831

Please sign in to comment.