Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

[PATCH 25/25] Consider `--tree` in versions completion.



From: Doron Behar <doron.behar@xxxxxxxxx>

---
 Completion/Unix/Command/_luarocks | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/Completion/Unix/Command/_luarocks b/Completion/Unix/Command/_luarocks
index 17fa8248e..a02bd06b5 100644
--- a/Completion/Unix/Command/_luarocks
+++ b/Completion/Unix/Command/_luarocks
@@ -59,8 +59,12 @@ __luarocks_rock_version(){
           # TODO: actually complete versions of installed rocks using the cache
           # How does luarocks handles multiple versions of the same package?
           # If anybody knows, please write something beautiful here
-          # TODO: get somehow from $@ the option given (if used) to --tree
-          _message -e "version for installed rock ${words[$i]}"
+          tree="$2"
+          if [[ -z "${tree}" ]]; then
+            _message -e "version for installed rock ${words[$i]}"
+          else
+            _message -e "version for installed rock ${words[$i]} on tree ${tree}"
+          fi
           return
           ;;
         "new_version")
@@ -440,7 +444,7 @@ _luarocks_remove(){
   _arguments -A "-*" \
     "${remove_command_options[@]}" \
     '1: :{__luarocks_rock "installed" '"${opt_args[--tree]}"'}' \
-    '2:: :{__luarocks_rock_version "installed"}'
+    '2:: :{__luarocks_rock_version "installed" '"${opt_args[--tree]}"'}'
 }
 # }}}
 # {{{ `search` command
-- 
2.17.0



Messages sorted by: Reverse Date, Date, Thread, Author