Skip to content

Commit a60faee

Browse files
authored
Merge pull request #301 from ergebnis/fix/arguments-and-options
Fix: Actually allow passing argument and options to command
2 parents 5c63fc9 + d2c3ebf commit a60faee

File tree

4 files changed

+31
-4
lines changed

4 files changed

+31
-4
lines changed

.github/workflows/continuous-integration.yml

+3
Original file line numberDiff line numberDiff line change
@@ -299,3 +299,6 @@ jobs:
299299

300300
- name: "Run composer-normalize.phar"
301301
run: "${{ env.COMPOSER_NORMALIZE_PHAR }}"
302+
303+
- name: "Run composer-normalize.phar with argument and options"
304+
run: "${{ env.COMPOSER_NORMALIZE_PHAR }} --dry-run composer.json"

CHANGELOG.md

+13-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## Unreleased
99

10-
For a full diff see [`2.1.1...master`][2.1.1...master].
10+
For a full diff see [`2.1.2...master`][2.1.2...master].
11+
12+
## [`2.1.2`][2.1.1]
13+
14+
For a full diff see [`2.1.1...2.1.2`][2.1.1...2.1.2].
15+
16+
### Fixed
17+
18+
* Allow passing argument and options to the command ([#301]), by [@localheinz]
1119

1220
## [`2.1.1`][2.1.1]
1321

@@ -275,6 +283,7 @@ For a full diff see [`81bc3a8...0.1.0`][81bc3a8...0.1.0].
275283
[2.0.2]: https://github.com/ergebnis/composer-normalize/releases/tag/2.0.2
276284
[2.1.0]: https://github.com/ergebnis/composer-normalize/releases/tag/2.1.0
277285
[2.1.1]: https://github.com/ergebnis/composer-normalize/releases/tag/2.1.1
286+
[2.1.2]: https://github.com/ergebnis/composer-normalize/releases/tag/2.1.2
278287

279288
[81bc3a8...0.1.0]: https://github.com/ergebnis/composer-normalize/compare/81bc3a8...0.1.0
280289
[0.1.0...0.2.0]: https://github.com/ergebnis/composer-normalize/compare/0.1.0...0.2.0
@@ -299,7 +308,8 @@ For a full diff see [`81bc3a8...0.1.0`][81bc3a8...0.1.0].
299308
[2.0.1...2.0.2]: https://github.com/ergebnis/composer-normalize/compare/2.0.1...2.0.2
300309
[2.0.2...2.1.0]: https://github.com/ergebnis/composer-normalize/compare/2.0.2...2.1.0
301310
[2.1.0...2.1.1]: https://github.com/ergebnis/composer-normalize/compare/2.1.0...2.1.1
302-
[2.1.1...master]: https://github.com/ergebnis/composer-normalize/compare/2.1.1...master
311+
[2.1.1...2.1.2]: https://github.com/ergebnis/composer-normalize/compare/2.1.1...2.1.2
312+
[2.1.2...master]: https://github.com/ergebnis/composer-normalize/compare/2.1.2...master
303313

304314
[#1]: https://github.com/ergebnis/composer-normalize/pull/1
305315
[#2]: https://github.com/ergebnis/composer-normalize/pull/2
@@ -338,6 +348,7 @@ For a full diff see [`81bc3a8...0.1.0`][81bc3a8...0.1.0].
338348
[#280]: https://github.com/ergebnis/composer-normalize/pull/280
339349
[#292]: https://github.com/ergebnis/composer-normalize/pull/292
340350
[#297]: https://github.com/ergebnis/composer-normalize/pull/297
351+
[#301]: https://github.com/ergebnis/composer-normalize/pull/301
341352

342353
[@ergebnis]: https://github.com/ergebnis
343354
[@localheinz]: https://github.com/localheinz

Makefile

+1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ phar: vendor ## Builds a phar with humbug/box
2828
git checkout HEAD -- composer.json composer.lock
2929
phar/box.phar info .build/phar/composer-normalize.phar
3030
.build/phar/composer-normalize.phar
31+
.build/phar/composer-normalize.phar --dry-run composer.json
3132

3233
.PHONY: static-code-analysis
3334
static-code-analysis: vendor ## Runs a static code analysis with phpstan/phpstan

phar/composer-normalize.php

+14-2
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
use Ergebnis\Json\Normalizer;
1818
use Ergebnis\Json\Printer;
1919
use Localheinz\Diff;
20+
use Symfony\Component\Console;
2021

2122
require_once __DIR__ . '/../vendor/autoload.php';
2223

@@ -33,5 +34,16 @@
3334
$application = new Normalize\Application();
3435

3536
$application->add($command);
36-
$application->setDefaultCommand($command->getName());
37-
$application->run();
37+
38+
if (1 === \count($argv) || 'normalize' !== $argv[1]) {
39+
\array_splice(
40+
$argv,
41+
1,
42+
0,
43+
[
44+
'normalize',
45+
]
46+
);
47+
}
48+
49+
$application->run(new Console\Input\ArgvInput($argv));

0 commit comments

Comments
 (0)