Skip to content

Commit c3f5193

Browse files
authored
New JBZoo/Cli (#12)
See the project homepage: https://github.com/JBZoo/Cli
1 parent e7057b0 commit c3f5193

File tree

8 files changed

+1471
-633
lines changed

8 files changed

+1471
-633
lines changed

.phan.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,10 @@
2121
'directory_list' => [
2222
'src',
2323

24+
'vendor/jbzoo/cli/src',
2425
'vendor/jbzoo/data/src',
2526
'vendor/jbzoo/markdown/src',
27+
2628
'vendor/symfony/console',
2729
'vendor/symfony/process',
2830
'vendor/composer/semver/src',

README.md

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

6269

composer-diff.php

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,11 @@
1515

1616
declare(strict_types=1);
1717

18-
// @codingStandardsIgnoreFile
18+
namespace JBZoo\ComposerDiff;
1919

20-
use JBZoo\ComposerDiff\Commands\DiffAction;
21-
use Symfony\Component\Console\Application;
20+
use JBZoo\Cli\CliApplication;
2221

23-
define('PATH_ROOT', __DIR__);
22+
const PATH_ROOT = __DIR__;
2423

2524
$vendorPaths = [
2625
__DIR__ . '/../../autoload.php',
@@ -29,16 +28,15 @@
2928
];
3029

3130
foreach ($vendorPaths as $file) {
32-
if (file_exists($file)) {
33-
define('JBZOO_COMPOSER_DIFF_INSTALL', $file);
31+
if (\file_exists($file)) {
32+
\define('JBZOO_AUTOLOAD_FILE', $file);
3433
break;
3534
}
3635
}
3736

38-
/** @psalm-suppress UnresolvableInclude */
39-
require JBZOO_COMPOSER_DIFF_INSTALL;
37+
require_once JBZOO_AUTOLOAD_FILE;
4038

41-
$application = new Application();
42-
$application->add(new DiffAction());
39+
$application = new CliApplication('JBZoo/CI-Report-Converter', '@git-version@');
40+
$application->registerCommandsByPath(__DIR__ . '/src/Commands', __NAMESPACE__);
4341
$application->setDefaultCommand('diff');
4442
$application->run();

composer.json

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,17 @@
2525

2626
"jbzoo/data" : "^4.3.0",
2727
"jbzoo/markdown" : "^1.1.0",
28+
"jbzoo/cli" : "^1.0.0",
29+
2830
"symfony/console" : ">=4.4",
2931
"symfony/process" : ">=4.4",
3032
"composer/semver" : ">=1.0"
3133
},
3234

3335
"require-dev" : {
3436
"jbzoo/toolbox-dev" : "^3.2.0",
35-
"roave/security-advisories" : "dev-master"
37+
"roave/security-advisories" : "dev-master",
38+
"composer/composer" : "^1.1 || ^2.0"
3639
},
3740

3841
"autoload" : {
@@ -48,9 +51,7 @@
4851
"bin" : ["composer-diff"],
4952
"config" : {
5053
"optimize-autoloader" : true,
51-
"allow-plugins" : {
52-
"composer/package-versions-deprecated" : true
53-
}
54+
"allow-plugins" : {"composer/package-versions-deprecated" : true}
5455
},
5556

5657
"extra" : {

0 commit comments

Comments
 (0)