From b2872595209439c568b8ee1226da1376fab0a876 Mon Sep 17 00:00:00 2001 From: AlexeyKosov Date: Tue, 11 Jul 2017 13:41:05 +0300 Subject: [PATCH 1/2] Update README.md docs: Mention installation process for a Symfony Framework app (#76) --- README.md | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 6aa6133..84c2355 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,7 @@ If you don't need any custom completion behaviour, you can simply add the comple $ composer require stecman/symfony-console-completion ``` -2. Add an instance of `CompletionCommand` to your application's `Application::getDefaultCommands()` method: +2. For standalone Symfony Console applications, add an instance of `CompletionCommand` to your application's `Application::getDefaultCommands()` method: ```php protected function getDefaultCommands() @@ -33,6 +33,18 @@ If you don't need any custom completion behaviour, you can simply add the comple //... } ``` + + For Symfony Framework applications, register the `CompletionCommand` as a service in `app/config/services.yml`: + + ```yaml + services: + #... + console.completion_command: + class: Stecman\Component\Symfony\Console\BashCompletion\CompletionCommand + tags: + - { name: console.command } + #... + ``` 3. Register completion for your application by running one of the following in a terminal, replacing `[program]` with the command you use to run your application (eg. 'composer'): From c5a2379564c435b06da8d8e870a87611c63ab388 Mon Sep 17 00:00:00 2001 From: Stephen Holdaway Date: Tue, 11 Jul 2017 23:10:52 +1200 Subject: [PATCH 2/2] Fix readme layout A few code blocks and paragraphs weren't indented to their parent bullet point. --- README.md | 60 +++++++++++++++++++++++++++---------------------------- 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/README.md b/README.md index 84c2355..642af26 100644 --- a/README.md +++ b/README.md @@ -25,41 +25,41 @@ If you don't need any custom completion behaviour, you can simply add the comple 2. For standalone Symfony Console applications, add an instance of `CompletionCommand` to your application's `Application::getDefaultCommands()` method: - ```php - protected function getDefaultCommands() - { - //... - $commands[] = new \Stecman\Component\Symfony\Console\BashCompletion\CompletionCommand(); - //... - } - ``` - - For Symfony Framework applications, register the `CompletionCommand` as a service in `app/config/services.yml`: - - ```yaml - services: - #... - console.completion_command: - class: Stecman\Component\Symfony\Console\BashCompletion\CompletionCommand - tags: - - { name: console.command } - #... - ``` + ```php + protected function getDefaultCommands() + { + //... + $commands[] = new \Stecman\Component\Symfony\Console\BashCompletion\CompletionCommand(); + //... + } + ``` + + For Symfony Framework applications, register the `CompletionCommand` as a service in `app/config/services.yml`: + + ```yaml + services: + #... + console.completion_command: + class: Stecman\Component\Symfony\Console\BashCompletion\CompletionCommand + tags: + - { name: console.command } + #... + ``` 3. Register completion for your application by running one of the following in a terminal, replacing `[program]` with the command you use to run your application (eg. 'composer'): - ```bash - # BASH ~4.x, ZSH - source <([program] _completion --generate-hook) + ```bash + # BASH ~4.x, ZSH + source <([program] _completion --generate-hook) - # BASH ~3.x, ZSH - [program] _completion --generate-hook | source /dev/stdin + # BASH ~3.x, ZSH + [program] _completion --generate-hook | source /dev/stdin - # BASH (any version) - eval $([program] _completion --generate-hook) - ``` + # BASH (any version) + eval $([program] _completion --generate-hook) + ``` - By default this registers completion for the absolute path to you application, which will work if the program on accessible on your PATH. You can specify a program name to complete for instead using the `--program` option, which is required if you're using an alias to run the program. + By default this registers completion for the absolute path to you application, which will work if the program on accessible on your PATH. You can specify a program name to complete for instead using the `--program` option, which is required if you're using an alias to run the program. 4. If you want the completion to apply automatically for all new shell sessions, add the command from step 3 to your shell's profile (eg. `~/.bash_profile` or `~/.zshrc`) @@ -83,7 +83,7 @@ By default, no completion results will be returned for option and argument value class MyCommand extends Command implements CompletionAwareInterface { ... - + public function completeOptionValues($optionName, CompletionContext $context) { if ($optionName == 'some-option') {