Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 1cfd6df

Browse filesBrowse files
adriaanzonfabpot
authored andcommitted
[Console] Add descriptions to Fish completion output
1 parent db21ee4 commit 1cfd6df
Copy full SHA for 1cfd6df

File tree

3 files changed

+9
-10
lines changed
Filter options

3 files changed

+9
-10
lines changed

‎src/Symfony/Component/Console/Completion/Output/FishCompletionOutput.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Console/Completion/Output/FishCompletionOutput.php
+6-3
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,14 @@ class FishCompletionOutput implements CompletionOutputInterface
2121
{
2222
public function write(CompletionSuggestions $suggestions, OutputInterface $output): void
2323
{
24-
$values = $suggestions->getValueSuggestions();
24+
$values = [];
25+
foreach ($suggestions->getValueSuggestions() as $value) {
26+
$values[] = $value->getValue().($value->getDescription() ? "\t".$value->getDescription() : '');
27+
}
2528
foreach ($suggestions->getOptionSuggestions() as $option) {
26-
$values[] = '--'.$option->getName();
29+
$values[] = '--'.$option->getName().($option->getDescription() ? "\t".$option->getDescription() : '');
2730
if ($option->isNegatable()) {
28-
$values[] = '--no-'.$option->getName();
31+
$values[] = '--no-'.$option->getName().($option->getDescription() ? "\t".$option->getDescription() : '');
2932
}
3033
}
3134
$output->write(implode("\n", $values));

‎src/Symfony/Component/Console/Resources/completion.fish

Copy file name to clipboardExpand all lines: src/Symfony/Component/Console/Resources/completion.fish
+1-5
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,7 @@ function _sf_{{ COMMAND_NAME }}
1919

2020
set completecmd $completecmd "-c$c"
2121

22-
set sfcomplete ($completecmd)
23-
24-
for i in $sfcomplete
25-
echo $i
26-
end
22+
$completecmd
2723
end
2824

2925
complete -c '{{ COMMAND_NAME }}' -a '(_sf_{{ COMMAND_NAME }})' -f

‎src/Symfony/Component/Console/Tests/Completion/Output/FishCompletionOutputTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Console/Tests/Completion/Output/FishCompletionOutputTest.php
+2-2
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@ public function getCompletionOutput(): CompletionOutputInterface
2323

2424
public function getExpectedOptionsOutput(): string
2525
{
26-
return "--option1\n--negatable\n--no-negatable";
26+
return "--option1\tFirst Option\n--negatable\tCan be negative\n--no-negatable\tCan be negative";
2727
}
2828

2929
public function getExpectedValuesOutput(): string
3030
{
31-
return "Green\nRed\nYellow";
31+
return "Green\tBeans are green\nRed\tRose are red\nYellow\tCanaries are yellow";
3232
}
3333
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.