* [PATCH] new completion for the lldb debugger
@ 2015-09-19 7:50 Jun T.
2015-09-21 12:05 ` Jun T.
0 siblings, 1 reply; 2+ messages in thread
From: Jun T. @ 2015-09-19 7:50 UTC (permalink / raw)
To: zsh-workers
---
Completion/Unix/Command/_lldb | 50 +++++++++++++++++++++++++++++++++++++++++++
1 file changed, 50 insertions(+)
create mode 100644 Completion/Unix/Command/_lldb
diff --git a/Completion/Unix/Command/_lldb b/Completion/Unix/Command/_lldb
new file mode 100644
index 0000000..c0b155e
--- /dev/null
+++ b/Completion/Unix/Command/_lldb
@@ -0,0 +1,50 @@
+#compdef lldb
+
+local curcontext=$curcontext state state_descr line expl ret=1
+typeset -A opt_args
+local -a args
+
+args=(
+ '*'{-o+,--one-line=}'[run one-line lldb command after loading executable]:lldb command: '
+ '*'{-s+,--source=}'[run lldb commands from a file after loading executable]:file:_files'
+ '*'{-O+,--one-line-before-file=}'[run one-line lldb command before loading executable]:lldb command'
+ '*'{-S+,--source-before-file=}'[run lldb commands from a file before loading executable]:file:_files'
+ '(-k --one-line-on-crash)'{-k+,--one-line-on-crash=}'[run one-line lldb command if target crashes in batch mode]:lldb command'
+ '(-K --source-on-crash)'{-K+,--source-on-crash=}'[run lldb commands from a file if target crashes in batch mode]:file:_files'
+ '(-b --batch)'{-b,--batch}'[run commands from -s -S -o -O and quit]'
+ '(-Q --source-quietly)'{-Q,--source-quietly}'[suppress output from -s, -S, -o or -O]'
+ '(-e --editor)'{-e,--editor}'[open source files using "external editor" mechanism]'
+ '(-x --no-lldbinit)'{-x,--no-lldbinit}'[do not automatically parse .lldbinit files]'
+ '(-X --no-use-colors)'{-X,--no-use-colors}'[do not use colors]'
+ '(-d --debug)'{-d,--debug}'[print extra information for debugging itself]'
+ '(-r --repl)'{-r,--repl}'[run lldb in REPL mode]'
+ '(-l --script-language)'{-l+,--script-language=}'[use the specified scripting language]:language:(Python Perl Ruby Tcl)'
+ - info
+ '(-)'{-h,--help}'[print the usage information]'
+ '(-)'{-v,--version}'[print the current version number]'
+ '(-)'{-P,--python-path}'[print path to the lldb.py file]'
+ - file
+ '(-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'
+ - 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]'
+ - pid
+ '(-p --attach-pid)'{-p+,--attach-pid=}'[attach to the specified process]:pid:_pids'
+)
+
+_arguments -C -s -S : $args && return 0
+
+case $state in
+ (arg1)
+ if [[ -z $opt_args[(I)file-(-f|--file)] ]]; then
+ _wanted executables expl 'executable' _files -g '*(-*)' && ret=0
+ else
+ _message -e arguments 'command argument'
+ fi
+esac
+
+return ret
--
1.9.5 (Apple Git-50.3)
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] new completion for the lldb debugger
2015-09-19 7:50 [PATCH] new completion for the lldb debugger Jun T.
@ 2015-09-21 12:05 ` Jun T.
0 siblings, 0 replies; 2+ messages in thread
From: Jun T. @ 2015-09-21 12:05 UTC (permalink / raw)
To: zsh-workers
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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-09-21 12:06 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-09-19 7:50 [PATCH] new completion for the lldb debugger Jun T.
2015-09-21 12:05 ` Jun T.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).