5f4e8e57da117b5fc2325ea411aafc66053b8570

Author
Andrey Janzen <andrey@janzen.su>
Committer
Marc Cornellà <marc.cornella@live.com>
Date

Message

Allow completion for 'composer.phar', not only 'composer'

Use $_comp_command1 for command list generation instead of 'composer':

  `$_comp_command1` contains the command written in the command line.
  This allows us to have a different composer name

Diff

 1diff --git a/plugins/composer/composer.plugin.zsh b/plugins/composer/composer.plugin.zsh
 2index f75119c4a9c0217895550be965bb10bc21c160c3..324bc64a0a86527c16f33e6b12cadc3dd42004fb 100644
 3--- a/plugins/composer/composer.plugin.zsh
 4+++ b/plugins/composer/composer.plugin.zsh
 5@@ -7,11 +7,11 @@
 6 
 7 # Composer basic command completion
 8 _composer_get_command_list () {
 9-	composer --no-ansi | sed "1,/Available commands/d" | awk '/^\s*[a-z]+/ { print $1 }'
10+    $_comp_command1 --no-ansi | sed "1,/Available commands/d" | awk '/^\s*[a-z]+/ { print $1 }'
11 }
12 
13 _composer_get_required_list () {
14-    composer show -s --no-ansi | sed '1,/requires/d' | awk 'NF > 0 && !/^requires \(dev\)/{ print $1 }'
15+    $_comp_command1 show -s --no-ansi | sed '1,/requires/d' | awk 'NF > 0 && !/^requires \(dev\)/{ print $1 }'
16 }
17 
18 _composer () {
19@@ -35,6 +35,7 @@ _composer () {
20 }
21 
22 compdef _composer composer
23+compdef _composer composer.phar
24 
25 # Aliases
26 alias c='composer'