* PATCH: _etags
@ 2013-04-04 14:46 Peter Stephenson
2013-04-04 15:07 ` Peter Stephenson
0 siblings, 1 reply; 2+ messages in thread
From: Peter Stephenson @ 2013-04-04 14:46 UTC (permalink / raw)
To: Zsh Hackers' List
Parsing etags --help for languages is a bit fraught, but I'm stuck
there.
Discovered "git diff --cached".
It's even possible I may be able to submit this...
diff --git a/Completion/Unix/Command/.distfiles b/Completion/Unix/Command/.distfiles
index abb5de7..9ce81f6 100644
--- a/Completion/Unix/Command/.distfiles
+++ b/Completion/Unix/Command/.distfiles
@@ -57,6 +57,7 @@ _elm
_enscript
_env
_espeak
+_etags
_fakeroot
_feh
_fetchmail
diff --git a/Completion/Unix/Command/_etags b/Completion/Unix/Command/_etags
new file mode 100644
index 0000000..d1644fd
--- /dev/null
+++ b/Completion/Unix/Command/_etags
@@ -0,0 +1,63 @@
+#compdef etags
+
+integer ret=1
+local context state line expl
+typeset -A opt_args
+
+_arguments \
+ '(-a --append)'{-a,--append}'[append tag entries]' \
+ '--packages-only[only generate tags for Ada packages]' \
+ '--declarations[C etc.: tags for function declarations]' \
+ '(-D --no-defines)'{-D,--no-defines}'[No tags for preprocessor definitions]' \
+ {-i-,--include=}'[Tag file should include another]:tag file:_files' \
+ {-l-,--language=}'[Specify language]:language:->lang' \
+ '--no-globals[No tag entries for global variables]' \
+ '--no-members[No tag entries for structure members]' \
+ {-r-,--regex=}'[Specify regular expression]:regular expression:->regex' \
+ {-R,--no-regex}'[No regular expressions for tags]' \
+ '(-I --ignore-indentation)'{-I,--ignore-indentation}'[Closing brace in first col may not be start of func]' \
+ '(-o --output)'{-o-,--output=}'[Specify output file]:file:_files' \
+ '--parse-stdin=[Specify file name for stdin]:file name:_files' \
+ '(-V --version)'{-V,--version}'[Output version]' \
+ '(-h --help)'{-h,--help}'[Output help]' \
+ '*:file to tag:_files' \
+ && ret=0
+
+case $state in
+ (lang)
+ local -a langs
+ langs=(${${${${(f)"$(etags --help)"}:#^ [^[:blank:]]##[[:blank:]]##([[:alnum:].]*|)}# }%%[[:blank:]]*})
+ _wanted languages expl language compadd -a langs && ret=0
+ ;;
+
+ (regex)
+ if compset -P @; then
+ _files && ret=0
+ elif [[ -n $PREFIX ]]; then
+ local sep=$PREFIX[1]
+ [[ $sep = [\\*?#] ]] && sep="\\$sep"
+ local -a match mbegin mend
+ if compset -P "$sep*$sep*$sep"; then
+ local mods=smi
+ mods=${mods//[${PREFIX}]}
+ if [[ -n $mods ]]; then
+ compset -P '*'
+ local -a modarr
+ [[ $mods = *i* ]] && modarr+=("i:ignore case")
+ [[ $mods = *m* ]] && modarr+=("m:allow multi-line matches")
+ [[ $mods = *s* ]] && modarr+=("s:multi-line, dot matches newline")
+ _describe -t modifiers modifier modarr && ret=0
+ fi
+ elif compset -P "$sep*$sep"; then
+ _message "tagname" && ret=0
+ else
+ compset -P "$sep"
+ _message "tag regexp" && ret=0
+ fi
+ else
+ _message "regexp separator or @ for file" && ret=0
+ fi
+ ;;
+esac
+
+return ret
--
Peter Stephenson <p.stephenson@samsung.com> Principal Software Engineer
Tel: +44 (0)1223 434724 Samsung Cambridge Solution Centre
St John's House, St John's Innovation Park,
Cowley Road, Cambridge, CB4 0DS, UK
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: PATCH: _etags
2013-04-04 14:46 PATCH: _etags Peter Stephenson
@ 2013-04-04 15:07 ` Peter Stephenson
0 siblings, 0 replies; 2+ messages in thread
From: Peter Stephenson @ 2013-04-04 15:07 UTC (permalink / raw)
To: Zsh Hackers' List
On Thu, 04 Apr 2013 15:46:01 +0100
Peter Stephenson <p.stephenson@samsung.com> wrote:
> It's even possible I may be able to submit this...
Well, it didn't obviously fail...
% git push
Counting objects: 14, done.
Compressing objects: 100% (8/8), done.
Writing objects: 100% (8/8), 1.66 KiB, done.
Total 8 (delta 5), reused 0 (delta 0)
remote: <Repository /nfs/sf-git/z/zs/zsh/code.git> refresh queued.
To https://pws@git.code.sf.net/p/zsh/code
648ab2c..0c32aa6 master -> master
Presumably lots of squiggles is good, this being git.
pws
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-04-04 15:17 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-04-04 14:46 PATCH: _etags Peter Stephenson
2013-04-04 15:07 ` Peter Stephenson
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).