Skip to content

Commit 4c5e237

Browse files
committed
feature #57518 Unify how --format is handled by commands (fabpot)
This PR was merged into the 7.2 branch. Discussion ---------- Unify how --format is handled by commands | Q | A | ------------- | --- | Branch? | 7.2 | Bug fix? | no | New feature? | yes <!-- please update src/**/CHANGELOG.md files --> | Deprecations? | yes <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files --> | Issues | n/a <!-- prefix each issue number with "Fix #", no need to create an issue if none exists, explain below instead --> | License | MIT We have many commands that have a `--format` option. This PR tries to unify the way we handle them: * Deprecate the `text` format (used only twice) in favor of the more common `txt` one; * Add auto-completion for `--format` in all commands; * Add help about the `--format` option in all commands that supports it (in a unified way) **Side note**: To avoid confusion, I think we should rename the `--format` option for the `uuid:generate` and `ulid:generate` commands as it does something different from the commonly used `--format` option. Commits ------- 848f855cdf Unify how --format is handle by commands
2 parents cc0c313 + ec6a914 commit 4c5e237

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

Command/LintCommand.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,9 @@ protected function configure(): void
7272
Or of a whole directory:
7373
7474
<info>php %command.full_name% dirname</info>
75+
76+
The <info>--format</info> option specifies the format of the command output:
77+
7578
<info>php %command.full_name% dirname --format=json</info>
7679
7780
You can also exclude one or more specific files:
@@ -266,6 +269,7 @@ public function complete(CompletionInput $input, CompletionSuggestions $suggesti
266269
}
267270
}
268271

272+
/** @return string[] */
269273
private function getAvailableFormatOptions(): array
270274
{
271275
return ['txt', 'json', 'github'];

0 commit comments

Comments
 (0)