zsh-workers
 help / color / mirror / code / Atom feed
From: Danek Duvall <duvall@comfychair.org>
To: zsh-workers@sunsite.dk
Subject: PATCH: _pkg* completion for Solaris
Date: Thu, 3 Nov 2005 18:22:27 -0800	[thread overview]
Message-ID: <20051104022227.GA3202@lorien.comfychair.org> (raw)

[-- Attachment #1: Type: text/plain, Size: 785 bytes --]

I've been meaning to write some completion functions for Solaris-specific
utilities and get them added to the zsh distribution if at all possible.
Some I've had written for some time, like the following, which are for the
packaging commands.  I've got some for the SMF and DTrace commands as well,
but they need some more work before they're all that good.

I'm generally writing to the latest Solaris bits (meaning the latest Nevada
bits available through opensolaris).  I'm not sure how best to deal with
the utilities changing through the releases, as most don't have usefully
parseable help outputs.  Perhaps a switch on the uname, assuming that
anything unrecognized is the latest stuff?

Anyway, I'll try to keep these coming.  I'd love to have 'em in by default.

Thanks,
Danek

[-- Attachment #2: zsh-solaris_pkg.patch --]
[-- Type: text/plain, Size: 4104 bytes --]

--- Completion/Solaris/Command/_pkgadd.orig	2005-11-03 18:12:14.000000000 -0800
+++ Completion/Solaris/Command/_pkgadd	2005-11-03 17:57:41.000000000 -0800
@@ -0,0 +1,32 @@
+#compdef pkgadd
+
+_pkgadd_pass() {
+	_values -S : 'password descriptor' \
+	'(file env console)pass[Literal password]:password:' \
+	'(pass file console)env[Environment variable]:environment:_parameters -g "*export*"' \
+	'(pass env console)file[File]:file:_files' \
+	'(pass env file)console[From /dev/tty]'
+}
+
+_pkgadd() {
+	_arguments -s \
+	'-d[Device]:device file:_files' \
+	'-x[HTTP(S) proxy]:HTTP proxy: ' \
+	'-k[Keystore]:keystore:_files' \
+	'-P[Password to decrypt keystore]:password:_pkgadd_pass' \
+	'-Y[Select packages by category]:category: ' \
+	- set1 \
+	'-n[Non-interactive mode]' \
+	'-v[Trace all scripts]' \
+	'-a[Admin file]:admin file:_files' \
+	"-M[Don't use vfstab file]" \
+	'-R[Root path]:root path:_files -/' \
+	'-r[Response file]:response file:_files' \
+	'-V[Alternate vfstab file]:vfstab file:_files' \
+	'*:package instance:_pkg_instance --_opts uninstalled:-d' \
+	- set2 \
+	'-s[Spool package]:spool directory:_files -/' \
+	'*:package instance:_pkg_instance --_opts uninstalled:-d'
+}
+
+_pkgadd "$@"
--- Completion/Solaris/Command/_pkginfo.orig	2005-11-03 18:12:14.000000000 -0800
+++ Completion/Solaris/Command/_pkginfo	2005-11-03 17:57:41.000000000 -0800
@@ -0,0 +1,22 @@
+#compdef pkginfo
+
+_pkginfo() {
+	_arguments -s \
+	'(-q -r -x)-l[Long listing]' \
+	'(-l -r -x)-q[Quiet mode]' \
+	'(-l -q -x)-r[Relocation base]' \
+	'(-l -q -r)-x[Extracted listing]' \
+	'-c[Category]:category: ' \
+	'-a[Architecture]:architecture: ' \
+	'-v[Version]:version: ' \
+	- set1 \
+	'(-p)-i[Select completely installed packages]' \
+	'(-i)-p[Select partially installed packages]' \
+	'-R[Root path]:root path:_files -/' \
+	'*:package instance:_pkg_instance --_opts installed:set1--R' \
+	- set2 \
+	'-d[Device]:device file:_files' \
+	'*:package instance:_pkg_instance --_opts uninstalled:set2--d'
+}
+
+_pkginfo "$@"
--- Completion/Solaris/Command/_pkgrm.orig	2005-11-03 18:12:14.000000000 -0800
+++ Completion/Solaris/Command/_pkgrm	2005-11-03 17:57:41.000000000 -0800
@@ -0,0 +1,20 @@
+#compdef pkgrm
+
+_pkgrm() {
+	_arguments -s \
+	'-Y[Select packages by category]:category: ' \
+	- set1 \
+	'-n[Non-interactive mode]' \
+	'-v[Trace all scripts]' \
+	'-a[Admin file]:admin file:_files' \
+	"-A[Force removal of all files]" \
+	"-M[Don't use vfstab file]" \
+	'-R[Root path]:root path:_files -/' \
+	'-V[Alternate vfstab file]:vfstab file:_files' \
+	'*:package instance:_pkg_instance --_opts installed:set1--R' \
+	- set2 \
+	'-s[Spool package]:spool directory:_files -/' \
+	'*:package instance:_pkg_instance --_opts spooled:set2--s'
+}
+
+_pkgrm "$@"
--- Completion/Solaris/Type/_pkg_instance.orig	2005-11-03 18:12:14.000000000 -0800
+++ Completion/Solaris/Type/_pkg_instance	2005-11-03 17:57:41.000000000 -0800
@@ -0,0 +1,20 @@
+#autoload
+
+local -A opts
+local whicharg
+
+zparseopts -E -D -- '-_opts:=opts'
+
+whicharg=${opts#*:}
+
+case ${opts%:*} in
+(installed)
+	compadd "$@" - ${opt_args[$whicharg]}/var/sadm/pkg/*/pkginfo(:h:t)
+	;;
+(spooled)
+	compadd "$@" - ${opt_args[$whicharg]}/*(:t)
+	;;
+(uninstalled)
+	compadd "$@" - ${opt_args[$whicharg]:-/var/spool/pkg}/*/pkgmap(:h:t)
+	;;
+esac
--- Src/Zle/complete.mdd.orig	2005-01-12 09:29:06.000000000 -0800
+++ Src/Zle/complete.mdd	2005-11-03 18:11:48.000000000 -0800
@@ -1,7 +1,7 @@
 name=zsh/complete
 link=either
 load=yes
-functions='Completion/*comp* Completion/AIX/*/* Completion/BSD/*/* Completion/Base/*/* Completion/Cygwin/*/* Completion/Darwin/*/* Completion/Debian/*/* Completion/Linux/*/* Completion/Mandrake/*/* Completion/Redhat/*/* Completion/Unix/*/* Completion/X/*/* Completion/Zsh/*/*'
+functions='Completion/*comp* Completion/AIX/*/* Completion/BSD/*/* Completion/Base/*/* Completion/Cygwin/*/* Completion/Darwin/*/* Completion/Debian/*/* Completion/Linux/*/* Completion/Mandrake/*/* Completion/Redhat/*/* Completion/Solaris/*/* Completion/Unix/*/* Completion/X/*/* Completion/Zsh/*/*'
 
 moddeps="zsh/zle"
 

             reply	other threads:[~2005-11-04  2:21 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-11-04  2:22 Danek Duvall [this message]
2005-11-04  7:23 ` Andrey Borzenkov
2005-11-04  8:04   ` Danek Duvall

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20051104022227.GA3202@lorien.comfychair.org \
    --to=duvall@comfychair.org \
    --cc=zsh-workers@sunsite.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).