Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e7e0485

Browse files
committed
Add negatable option to Fish completion output
1 parent 2bbba2f commit e7e0485

File tree

2 files changed

+36
-0
lines changed

2 files changed

+36
-0
lines changed

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ public function write(CompletionSuggestions $suggestions, OutputInterface $outpu
2424
$values = $suggestions->getValueSuggestions();
2525
foreach ($suggestions->getOptionSuggestions() as $option) {
2626
$values[] = '--'.$option->getName();
27+
if ($option->isNegatable()) {
28+
$values[] = '--no-'.$option->getName();
29+
}
2730
}
2831
$output->write(implode("\n", $values));
2932
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <[email protected]>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace Symfony\Component\Console\Tests\Completion\Output;
13+
14+
use Symfony\Component\Console\Completion\Output\CompletionOutputInterface;
15+
use Symfony\Component\Console\Completion\Output\FishCompletionOutput;
16+
17+
class FishCompletionOutputTest extends CompletionOutputTestCase
18+
{
19+
public function getCompletionOutput(): CompletionOutputInterface
20+
{
21+
return new FishCompletionOutput();
22+
}
23+
24+
public function getExpectedOptionsOutput(): string
25+
{
26+
return "--option1\n--negatable\n--no-negatable";
27+
}
28+
29+
public function getExpectedValuesOutput(): string
30+
{
31+
return "Green\nRed\nYellow";
32+
}
33+
}

0 commit comments

Comments
 (0)