Skip to content

Commit

Permalink
Merge pull request #301 from ergebnis/fix/arguments-and-options
Browse files Browse the repository at this point in the history
Fix: Actually allow passing argument and options to command
  • Loading branch information
localheinz authored Dec 28, 2019
2 parents 5c63fc9 + d2c3ebf commit a60faee
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 4 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -299,3 +299,6 @@ jobs:

- name: "Run composer-normalize.phar"
run: "${{ env.COMPOSER_NORMALIZE_PHAR }}"

- name: "Run composer-normalize.phar with argument and options"
run: "${{ env.COMPOSER_NORMALIZE_PHAR }} --dry-run composer.json"
15 changes: 13 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## Unreleased

For a full diff see [`2.1.1...master`][2.1.1...master].
For a full diff see [`2.1.2...master`][2.1.2...master].

## [`2.1.2`][2.1.1]

For a full diff see [`2.1.1...2.1.2`][2.1.1...2.1.2].

### Fixed

* Allow passing argument and options to the command ([#301]), by [@localheinz]

## [`2.1.1`][2.1.1]

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

[81bc3a8...0.1.0]: https://github.com/ergebnis/composer-normalize/compare/81bc3a8...0.1.0
[0.1.0...0.2.0]: https://github.com/ergebnis/composer-normalize/compare/0.1.0...0.2.0
Expand All @@ -299,7 +308,8 @@ For a full diff see [`81bc3a8...0.1.0`][81bc3a8...0.1.0].
[2.0.1...2.0.2]: https://github.com/ergebnis/composer-normalize/compare/2.0.1...2.0.2
[2.0.2...2.1.0]: https://github.com/ergebnis/composer-normalize/compare/2.0.2...2.1.0
[2.1.0...2.1.1]: https://github.com/ergebnis/composer-normalize/compare/2.1.0...2.1.1
[2.1.1...master]: https://github.com/ergebnis/composer-normalize/compare/2.1.1...master
[2.1.1...2.1.2]: https://github.com/ergebnis/composer-normalize/compare/2.1.1...2.1.2
[2.1.2...master]: https://github.com/ergebnis/composer-normalize/compare/2.1.2...master

[#1]: https://github.com/ergebnis/composer-normalize/pull/1
[#2]: https://github.com/ergebnis/composer-normalize/pull/2
Expand Down Expand Up @@ -338,6 +348,7 @@ For a full diff see [`81bc3a8...0.1.0`][81bc3a8...0.1.0].
[#280]: https://github.com/ergebnis/composer-normalize/pull/280
[#292]: https://github.com/ergebnis/composer-normalize/pull/292
[#297]: https://github.com/ergebnis/composer-normalize/pull/297
[#301]: https://github.com/ergebnis/composer-normalize/pull/301

[@ergebnis]: https://github.com/ergebnis
[@localheinz]: https://github.com/localheinz
Expand Down
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ phar: vendor ## Builds a phar with humbug/box
git checkout HEAD -- composer.json composer.lock
phar/box.phar info .build/phar/composer-normalize.phar
.build/phar/composer-normalize.phar
.build/phar/composer-normalize.phar --dry-run composer.json

.PHONY: static-code-analysis
static-code-analysis: vendor ## Runs a static code analysis with phpstan/phpstan
Expand Down
16 changes: 14 additions & 2 deletions phar/composer-normalize.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
use Ergebnis\Json\Normalizer;
use Ergebnis\Json\Printer;
use Localheinz\Diff;
use Symfony\Component\Console;

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

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

$application->add($command);
$application->setDefaultCommand($command->getName());
$application->run();

if (1 === \count($argv) || 'normalize' !== $argv[1]) {
\array_splice(
$argv,
1,
0,
[
'normalize',
]
);
}

$application->run(new Console\Input\ArgvInput($argv));

0 comments on commit a60faee

Please sign in to comment.