Skip to content

Commit

Permalink
New JBZoo/Cli (#12)
Browse files Browse the repository at this point in the history
See the project homepage: https://github.com/JBZoo/Cli
  • Loading branch information
SmetDenis authored Apr 12, 2022
1 parent e7057b0 commit c3f5193
Show file tree
Hide file tree
Showing 8 changed files with 1,471 additions and 633 deletions.
2 changes: 2 additions & 0 deletions .phan.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,10 @@
'directory_list' => [
'src',

'vendor/jbzoo/cli/src',
'vendor/jbzoo/data/src',
'vendor/jbzoo/markdown/src',

'vendor/symfony/console',
'vendor/symfony/process',
'vendor/composer/semver/src',
Expand Down
31 changes: 19 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,18 +45,25 @@ Usage:
diff [options]
Options:
--source=SOURCE The file, git ref, or git ref with filename to compare FROM [default: "HEAD:composer.lock"]
--target=TARGET The file, git ref, or git ref with filename to compare TO [default: "./composer.lock"]
--env=ENV Show only selected environment. Available options: both, require, require-dev [default: "both"]
--output=OUTPUT Output format. Available options: console, markdown, json [default: "console"]
--no-links Hide all links in tables
--strict Return exit code if you have any difference
-h, --help Display help for the given command. When no command is given display help for the diff command
-q, --quiet Do not output any message
-V, --version Display this application version
--ansi|--no-ansi Force (or disable --no-ansi) ANSI output
-n, --no-interaction Do not ask any interactive question
-v|vv|vvv, --verbose Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
--source=SOURCE The file, git ref, or git ref with filename to compare FROM [default: "HEAD:composer.lock"]
--target=TARGET The file, git ref, or git ref with filename to compare TO [default: "./composer.lock"]
--env=ENV Show only selected environment. Available options: both, require, require-dev [default: "both"]
--output=OUTPUT Output format. Available options: console, markdown, json [default: "console"]
--no-links Hide all links in tables
--strict Return exit code if you have any difference
--no-progress Disable progress bar animation for logs
--mute-errors Mute any sort of errors. So exit code will be always "0" (if it's possible).
It has major priority then --non-zero-on-error. It's on your own risk!
--stdout-only For any errors messages application will use StdOut instead of StdErr. It's on your own risk!
--non-zero-on-error None-zero exit code on any StdErr message
--timestamp Show timestamp at the beginning of each message
--profile Display timing and memory usage information
-h, --help Display help for the given command. When no command is given display help for the diff command
-q, --quiet Do not output any message
-V, --version Display this application version
--ansi|--no-ansi Force (or disable --no-ansi) ANSI output
-n, --no-interaction Do not ask any interactive question
-v|vv|vvv, --verbose Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
```


Expand Down
18 changes: 8 additions & 10 deletions composer-diff.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,11 @@

declare(strict_types=1);

// @codingStandardsIgnoreFile
namespace JBZoo\ComposerDiff;

use JBZoo\ComposerDiff\Commands\DiffAction;
use Symfony\Component\Console\Application;
use JBZoo\Cli\CliApplication;

define('PATH_ROOT', __DIR__);
const PATH_ROOT = __DIR__;

$vendorPaths = [
__DIR__ . '/../../autoload.php',
Expand All @@ -29,16 +28,15 @@
];

foreach ($vendorPaths as $file) {
if (file_exists($file)) {
define('JBZOO_COMPOSER_DIFF_INSTALL', $file);
if (\file_exists($file)) {
\define('JBZOO_AUTOLOAD_FILE', $file);
break;
}
}

/** @psalm-suppress UnresolvableInclude */
require JBZOO_COMPOSER_DIFF_INSTALL;
require_once JBZOO_AUTOLOAD_FILE;

$application = new Application();
$application->add(new DiffAction());
$application = new CliApplication('JBZoo/CI-Report-Converter', '@git-version@');
$application->registerCommandsByPath(__DIR__ . '/src/Commands', __NAMESPACE__);
$application->setDefaultCommand('diff');
$application->run();
9 changes: 5 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,17 @@

"jbzoo/data" : "^4.3.0",
"jbzoo/markdown" : "^1.1.0",
"jbzoo/cli" : "^1.0.0",

"symfony/console" : ">=4.4",
"symfony/process" : ">=4.4",
"composer/semver" : ">=1.0"
},

"require-dev" : {
"jbzoo/toolbox-dev" : "^3.2.0",
"roave/security-advisories" : "dev-master"
"roave/security-advisories" : "dev-master",
"composer/composer" : "^1.1 || ^2.0"
},

"autoload" : {
Expand All @@ -48,9 +51,7 @@
"bin" : ["composer-diff"],
"config" : {
"optimize-autoloader" : true,
"allow-plugins" : {
"composer/package-versions-deprecated" : true
}
"allow-plugins" : {"composer/package-versions-deprecated" : true}
},

"extra" : {
Expand Down
Loading

0 comments on commit c3f5193

Please sign in to comment.