|
2 | 2 |
|
3 | 3 | Automatic BASH completion for Symfony Console Component based applications. Completes commands and options by default, and allows for custom option/argument completion handlers to be set. |
4 | 4 |
|
5 | | -**Note that this is not entirely finished:** |
6 | | - |
7 | | -* Long-form options do not support completion yet (only shortcuts do) |
8 | | - |
9 | 5 | ## Use |
10 | 6 |
|
11 | | -If you don't need any custom completion behaviour, just add an instance of `CompletionCommand` to your application's `Application::getDefaultCommands()` method. Once you've done this, you can run (or add to your bash profile): |
| 7 | +If you don't need any custom completion behaviour, just add an instance of `CompletionCommand` to your application's `Application::getDefaultCommands()` method. Once you've done this, you can run this to enable completion: |
12 | 8 |
|
13 | | - eval `[your-application] _completion --genhook` |
| 9 | + eval `[your-application] _completion -g [program-name]` |
| 10 | + |
| 11 | +Where `[program-name]` is the name you want to register bash completion for. |
14 | 12 |
|
15 | 13 | This will generate and run a small bash script which creates a small BASH function and registers completion for your appliction name. Completion is then handled by running your application as `[your-application] _completion`. |
16 | 14 |
|
17 | 15 | ### Custom completion |
18 | 16 |
|
19 | | -Custom completion behaviour for arguments and option values can be added by sub-classing `CompletionCommand` (this will change very soon): |
| 17 | +Custom completion behaviour for arguments and option values can be added by sub-classing `CompletionCommand`: |
20 | 18 |
|
21 | 19 |
|
22 | | - class BeamCompletionCommand extends CompletionCommand{ |
| 20 | + class MyCompletionCommand extends CompletionCommand{ |
23 | 21 |
|
24 | 22 | protected function runCompletion() |
25 | 23 | { |
@@ -77,6 +75,8 @@ This will complete for both commands: |
77 | 75 |
|
78 | 76 | Option handlers work the same way as argument handlers, except you use `Completion::TYPE_OPTION` for the type. |
79 | 77 |
|
| 78 | +**Note this functionality is not yet complete:** long-form options (eg `--hello="world"`) do not support completion yet. Only option shortcut completion works (eg. `-h [tab]`). |
| 79 | + |
80 | 80 | Completion::makeGlobalHandler( |
81 | 81 | 'weather', Completion::TYPE_OPTION, |
82 | 82 | array('raining', 'sunny', 'everything is on fire!') |
|
0 commit comments