New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ChangelogLinker] Allow to specify path to CHANGELOG.md as argument #1047

Merged
merged 8 commits into from Sep 2, 2018
Next

[ChangelogLinker] Allow to specify path to CHANGELOG.md as argument

  • Loading branch information...
TomasVotruba committed Sep 1, 2018
commit c07c49ae4eff067db7cfe5e5ed1b283ae37c8c29
@@ -4,14 +4,14 @@
require_once __DIR__ . '/autoload.php';
use Psr\Container\ContainerInterface;
use Symplify\PackageBuilder\Console\ConfigAwareApplication;
use Symplify\ChangelogLinker\Console\ChangelogConsoleApplication;
use Symplify\PackageBuilder\Console\ThrowableRenderer;
try {
/** @var ContainerInterface $container */
$container = require_once __DIR__ . '/container.php';
$application = $container->get(ConfigAwareApplication::class);
$application = $container->get(ChangelogConsoleApplication::class);
exit($application->run());
} catch (Throwable $throwable) {
(new ThrowableRenderer())->render($throwable);
@@ -0,0 +1,24 @@
<?php declare(strict_types=1);
namespace Symplify\ChangelogLinker\Console;
use Symfony\Component\Console\Application;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputDefinition;
use Symfony\Component\Console\Input\InputOption;
final class ChangelogConsoleApplication extends Application
{
protected function getDefaultInputDefinition(): InputDefinition
{
$inputDefinition = parent::getDefaultInputDefinition();
// adds "file" argument
$inputDefinition->addArgument(new InputArgument('file', InputArgument::OPTIONAL, 'Path to CHANGELOG.md', getcwd() . '/CHANGELOG.md'));
// adds "--config" | "-c" option
$inputDefinition->addOption(new InputOption('config', 'c', InputOption::VALUE_REQUIRED, 'Config file.'));
return $inputDefinition;
}
}
@@ -35,6 +35,10 @@ protected function configure(): void
protected function execute(InputInterface $input, OutputInterface $output): int
{
$file = $input->getArgument('file');
dump($file);
die;
$changelogContent = $this->changelogFileSystem->readChangelog();
$processedChangelogContent = $this->changelogLinker->processContent($changelogContent);
ProTip! Use n and p to navigate between commits in a pull request.