Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
PATCH: new completion for zeal offline documentation viewer
- X-seq: zsh-workers 43328
- From: Oliver Kiddle <okiddle@xxxxxxxxxxx>
- To: Zsh workers <zsh-workers@xxxxxxx>
- Subject: PATCH: new completion for zeal offline documentation viewer
- Date: Thu, 23 Aug 2018 18:12:46 +0200
- Authentication-results: amavisd4.gkg.net (amavisd-new); dkim=pass (2048-bit key) header.d=yahoo.co.uk
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.co.uk; s=s2048; t=1535040770; bh=DGP97oMpDtOjTaTkQ5Vr9bEe1zn6+Z+obwTt2+m4VQM=; h=From:To:Subject:Date:From:Subject; b=TjrmT5jAU6Gc5aXD6NM5RK4qlYiRQ66bToURVyo6orhVYdnwAKn4ep0hUwm5gPmY2VmBu1Qfj1HLPO+pkJOx680tKOg6fqOVVj8PeZvMCN7nhaUc+ylLYnLli1thaSbGKyR3VyUsYPd8affse4kQcnRgXGNxXfbFsxLxzRgDa3Aa0Sv7ns/xVyarLd+4hCtRsf29p348PJDbdudAeMZsU4FLp+Q0LH9dL2SRD0tE7wGc3u4kZVj2nlR1GjUv7/dYHVDjfd5LbAFXRQ2+l6hq9okD9R7ejFHIG5YXJcrla9ThiDixG7FZWNjw+NErxVKEzABUTNgVpelBUHqxxhg0Nw==
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- List-unsubscribe: <mailto:zsh-workers-unsubscribe@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
This adds completioin for zeal - https://zealdocs.org/
Oliver
diff --git a/Completion/X/Command/_zeal b/Completion/X/Command/_zeal
new file mode 100644
index 000000000..334331d40
--- /dev/null
+++ b/Completion/X/Command/_zeal
@@ -0,0 +1,43 @@
+#compdef zeal
+
+local curcontext="$curcontext" cfg docset setdir mbegin mend ret=1
+local -a state line expl suf docsets globbed match
+local -A opt_args dsets
+
+_arguments -S \
+ ':query:->queries' \
+ + '(opt)' \
+ {-h,--help}'[display help information]' \
+ {-v,--version}'[display version information]' \
+ {-f,--force}'[force the application to run]' && ret=0
+
+if [[ -n $state ]]; then
+ cfg=${XDG_CONFIG_HOME:-~/.config}/Zeal/Zeal.conf
+ if [[ -r $cfg ]]; then
+ docsets=${${(M)${(f)"$(<$cfg)"}:#path=*}#path=}
+ else
+ docsets=${XDG_DATA_HOME:-~/.local/share}/Zeal/Zeal/docsets
+ fi
+ for docset in $docsets/*.docset/Contents/Info.plist(N); do
+ setdir=${docset:h:h:r:t:l:gs/+/p}
+ [[ $(<$docset) = *DocSetPlatformFamily\<[^\<]#\<string\>(#b)([^\<]#)* ]] ||
+ match=( ${docset:h:h:r:t:l:gs/+/p} )
+ dsets+=( $match[1] ${docset:h} )
+ done
+ if compset -P 1 '*:'; then
+ globbed=( ${dsets[${IPREFIX%:}]}/Resources/docSet.dsidx(N[1]) )
+ if (( $+commands[sqlite3] )) && [[ -e $globbed ]]; then
+ _description queries expl 'query'
+ compadd "$expl[@]" - ${(f)"$(_call_program queries
+ sqlite3 $globbed 'select name from searchIndex')"} && ret=0
+ else
+ _message -e queries 'query'
+ fi
+ else
+ compset -S ':*' || suf=( -qS : )
+ _description docsets expl 'docset'
+ compadd "$expl[@]" $suf -k dsets && ret=0
+ fi
+fi
+
+return ret
Messages sorted by:
Reverse Date,
Date,
Thread,
Author