diff options
-rw-r--r-- | Makefile | 1 | ||||
-rw-r--r-- | _xtools | 74 |
2 files changed, 75 insertions, 0 deletions
diff --git a/Makefile b/Makefile index 085d450..e8058b0 100644 --- a/Makefile +++ b/Makefile @@ -5,4 +5,5 @@ all: install: for f in x*[^~]; do install -Dm0755 $$f $(DESTDIR)$(PREFIX)/bin/$$f; done + install -Dm644 _xtools /usr/share/zsh/site-functions/_xtools diff --git a/_xtools b/_xtools new file mode 100644 index 0000000..3389737 --- /dev/null +++ b/_xtools @@ -0,0 +1,74 @@ +#compdef xbulk xbump xdiff xgensum xgrep xlg xlog xls xmindep xnew xnuxnu xoptdiff xq xsrc + +_xbps # force autoload + +_xtools_all_packages() { + compadd "$@" -- $(xdistdir)/srcpkgs/*(:t) +} + +_xbulk() { + _arguments : \ + '-n[dry-run]' \ + '-k[keep going when a build fails]' \ + '*:available templates:_xtools_all_packages' +} + +_xtools_one_template() { + _arguments : \ + ':available templates:_xtools_all_packages' +} + +_xdiff() { + _arguments : \ + '-u[only display differences]' \ + ':directory:_files -/' +} + +_xgensum() { + _arguments : \ + '-i[substitute in-place]' \ + ':available templates:_xtools_all_packages' +} + +_xgrep() { + _arguments : \ + '1:pattern: ' \ + '*:package:_xbps_installed_packages' +} + +_xtools_just_packages() { + _arguments : \ + '*:package:_xbps_all_packages' +} + +_xoptdiff() { + _arguments : \ + '-q[only list differing packages]' \ + '*:package:_xbps_installed_packages' +} + +_xq() { + _arguments : \ + '-R[include remote information too]' \ + '*:package:_xbps_all_packages' +} + +_xtools() { + case "$service" in + xbulk) _xbulk "$@";; + xbump) _xtools_one_template "$@";; + xdiff) _xdiff "$@";; + xgensum) _xgensum "$@";; + xgrep) _xgrep "$@";; + xlg) _xtools_one_template "$@";; + xlog) _xtools_one_template "$@";; + xls) _xtools_just_packages "$@";; + xmindep) _xtools_just_packages "$@";; + xnuxnu) _xtools_one_template "$@";; + xoptdiff) _xoptdiff "$@";; + xq) _xq "$@";; + xsrc) _xtool_one_template "$@";; + esac +} + +_xtools "$@" |