From 5f4e8e57da117b5fc2325ea411aafc66053b8570 Mon Sep 17 00:00:00 2001
From: Andrey Janzen <andrey@janzen.su>
Date: Fri, 26 Jul 2013 00:37:11 +0700
Subject: 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
---
 plugins/composer/composer.plugin.zsh | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

(limited to 'plugins')

diff --git a/plugins/composer/composer.plugin.zsh b/plugins/composer/composer.plugin.zsh
index f75119c4a..324bc64a0 100644
--- a/plugins/composer/composer.plugin.zsh
+++ b/plugins/composer/composer.plugin.zsh
@@ -7,11 +7,11 @@
 
 # Composer basic command completion
 _composer_get_command_list () {
-	composer --no-ansi | sed "1,/Available commands/d" | awk '/^\s*[a-z]+/ { print $1 }'
+    $_comp_command1 --no-ansi | sed "1,/Available commands/d" | awk '/^\s*[a-z]+/ { print $1 }'
 }
 
 _composer_get_required_list () {
-    composer show -s --no-ansi | sed '1,/requires/d' | awk 'NF > 0 && !/^requires \(dev\)/{ print $1 }'
+    $_comp_command1 show -s --no-ansi | sed '1,/requires/d' | awk 'NF > 0 && !/^requires \(dev\)/{ print $1 }'
 }
 
 _composer () {
@@ -35,6 +35,7 @@ _composer () {
 }
 
 compdef _composer composer
+compdef _composer composer.phar
 
 # Aliases
 alias c='composer'
-- 
cgit v1.2.3-70-g09d2