File tree 3 files changed +63
-0
lines changed
src/Symfony/Component/Console
3 files changed +63
-0
lines changed Original file line number Diff line number Diff line change 14
14
use Symfony \Component \Console \Completion \CompletionInput ;
15
15
use Symfony \Component \Console \Completion \CompletionSuggestions ;
16
16
use Symfony \Component \Console \Completion \Output \BashCompletionOutput ;
17
+ use Symfony \Component \Console \Completion \Output \FishCompletionOutput ;
17
18
use Symfony \Component \Console \Exception \CommandNotFoundException ;
18
19
use Symfony \Component \Console \Exception \ExceptionInterface ;
19
20
use Symfony \Component \Console \Input \InputInterface ;
@@ -32,6 +33,7 @@ final class CompleteCommand extends Command
32
33
33
34
private static $ completionOutputs = [
34
35
'bash ' => BashCompletionOutput::class,
36
+ 'fish ' => FishCompletionOutput::class,
35
37
];
36
38
37
39
private $ isDebug = false ;
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ /*
4
+ * This file is part of the Symfony package.
5
+ *
6
+ * (c) Fabien Potencier <fabien@symfony.com>
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 \Completion \Output ;
13
+
14
+ use Symfony \Component \Console \Completion \CompletionSuggestions ;
15
+ use Symfony \Component \Console \Output \OutputInterface ;
16
+
17
+ /**
18
+ * @author Guillaume Aveline <guillaume.aveline@pm.me>
19
+ */
20
+ class FishCompletionOutput implements CompletionOutputInterface
21
+ {
22
+ public function write (CompletionSuggestions $ suggestions , OutputInterface $ output ): void
23
+ {
24
+ $ options = [];
25
+ foreach ($ suggestions ->getOptionSuggestions () as $ option ) {
26
+ $ options [] = '-- ' .$ option ->getName ();
27
+ }
28
+ $ output ->write (implode (\PHP_EOL , $ options ));
29
+
30
+ $ output ->writeln (implode (\PHP_EOL , $ suggestions ->getValueSuggestions ()));
31
+ }
32
+ }
Original file line number Diff line number Diff line change
1
+ # This file is part of the Symfony package.
2
+ #
3
+ # (c) Fabien Potencier <fabien@symfony.com>
4
+ #
5
+ # For the full copyright and license information, please view
6
+ # https://symfony.com/doc/current/contributing/code/license.html
7
+
8
+ function _sf_{{ COMMAND_NAME }}
9
+ set sf_cmd (string split ' ' (commandline ))
10
+ set c (math (count $sf_cmd ) - 1)
11
+
12
+ set completecmd " $sf_cmd [1]" " _complete" " -sfish" " -S5.4.0-DEV"
13
+
14
+ for i in $sf_cmd
15
+ if [ $i != " " ]
16
+ set completecmd $completecmd " -i '$i '"
17
+ end
18
+ end
19
+
20
+ set completecmd $completecmd " -c$c "
21
+
22
+ set sfcomplete ($completecmd )
23
+
24
+ for i in $sfcomplete
25
+ echo $i
26
+ end
27
+ end
28
+
29
+ complete -c ' {{ COMMAND_NAME }}' -a ' (_sf_{{ COMMAND_NAME }})' -f
You can’t perform that action at this time.
0 commit comments