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

Re: [PATCH] new completion for the lldb debugger



I will commit this with a additional patch, which enables to complete
args/opts of the command (executable) in the following case
% lldb -- command <TAB>


diff --git a/Completion/Unix/Command/_lldb b/Completion/Unix/Command/_lldb
index c0b155e..16e346c 100644
--- a/Completion/Unix/Command/_lldb
+++ b/Completion/Unix/Command/_lldb
@@ -27,8 +27,7 @@ args=(
     '(-f --file)'{-f+,--file=}'[specify executable file to debug]:executable:_files -g "*(-*)"'
     '(-a --arch)'{-a+,--arch=}'[use the specified architecture]:arch'
     '(-c --core)'{-c+,--core=}'[specify core file to open]:core file:_files -g "*core*(-.)"'
-    '1: :->arg1'
-    '*:command argument'
+    '*::executable and arguments:->exe_args'
   - name
     '(-n --attach-name)'{-n+,--attach-name=}'[attach to the named process]:process name'
     '(-w --wait-for)'{-w,--wait-for}'[wait for the specified process to launch]'
@@ -39,11 +38,17 @@ args=(
 _arguments -C -s -S : $args && return 0
 
 case $state in
-  (arg1)
+  (exe_args)
     if [[ -z $opt_args[(I)file-(-f|--file)] ]]; then
-      _wanted executables expl 'executable' _files -g '*(-*)' && ret=0
+      if [[ $CURRENT -eq 1 ]]; then
+        _wanted executables expl 'executable' _files -g '*(-*)' && ret=0
+      else
+	_normal && ret=0
+      fi
     else
-      _message -e arguments 'command argument'
+      words=( ${(v)opt_args[(i)file-(-f|--file)]} "$words[@]" )
+      (( CURRENT++ ))
+      _normal && ret=0
     fi
 esac
 




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