Skip to content

Commit

Permalink
Add a 'path' argument to the clean command for controlling the path (#19
Browse files Browse the repository at this point in the history
)
  • Loading branch information
cable8mm committed Mar 6, 2024
1 parent d57cd00 commit 6c9f597
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
16 changes: 14 additions & 2 deletions src/Command/CleanCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;

#[AsCommand(
Expand All @@ -15,15 +16,26 @@
)]
class CleanCommand extends Command
{
protected function configure()
{
$this->addOption(
'path',
'p',
InputOption::VALUE_OPTIONAL,
'Please specify the path to delete all files.',
__DIR__.'/../../dist/'
);
}

/**
* Create Markdown files
*
* Run bin/console delete-markdowns
*/
protected function execute(InputInterface $input, OutputInterface $output): int
{
array_map('unlink', array_filter((array) glob(__DIR__.'/../../dist/*.markdown')));
array_map('unlink', array_filter((array) glob(__DIR__.'/../../dist/*.md')));
array_map('unlink', array_filter((array) glob($input->getOption('path').'*.markdown')));
array_map('unlink', array_filter((array) glob($input->getOption('path').'*.md')));

return Command::SUCCESS;
}
Expand Down
3 changes: 1 addition & 2 deletions src/Command/CreateJekyllCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,11 @@ function ($item) {
return preg_replace('/\[[^\]]+\]\n?/u', '', $item);
}
)
->setAddHours(24 * 365 + 24 * 120)
->resolveCategories($this->categories)
->in($row);

$jekyll = new Jekyll(
layout: 'post',
layout: 'single',
title: $article->title,
date: $article->publishedAt,
author: 'Companimal',
Expand Down

0 comments on commit 6c9f597

Please sign in to comment.