#!/usr/bin/env php
<?php
use ConventionalChangelog\DefaultCommand;
use Symfony\Component\Console\Application;
// Autoload
$files = [
__DIR__ . '/../../autoload.php',
__DIR__ . '/../vendor/autoload.php',
__DIR__ . '/vendor/autoload.php',
];
foreach ($files as $file) {
if (file_exists($file)) {
require_once $file;
break;
}
}
// Report only fatal errors
error_reporting(2039);
// Config
$config = [];
$configName = '.changelog';
$configFiles = [
getcwd() . '/' . $configName, // Working dir
__DIR__ . '/../../../' . $configName, // Project path
];
foreach ($configFiles as $file) {
if (is_file($file) && empty($config)) {
$config = require $file;
}
}
// Command
$command = new DefaultCommand($config);
$commandName = $command->getName();
// Run application single command
$application = new Application('conventional-changelog', '1.8.0');
$application->add($command);
$application->setDefaultCommand($commandName, true);
$application->run();
|