zsh-workers
 help / color / mirror / code / Atom feed
* PATCH: _pkg* completion for Solaris
@ 2005-11-04  2:22 Danek Duvall
  2005-11-04  7:23 ` Andrey Borzenkov
  0 siblings, 1 reply; 3+ messages in thread
From: Danek Duvall @ 2005-11-04  2:22 UTC (permalink / raw)
  To: zsh-workers

[-- 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"
 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: PATCH: _pkg* completion for Solaris
  2005-11-04  2:22 PATCH: _pkg* completion for Solaris Danek Duvall
@ 2005-11-04  7:23 ` Andrey Borzenkov
  2005-11-04  8:04   ` Danek Duvall
  0 siblings, 1 reply; 3+ messages in thread
From: Andrey Borzenkov @ 2005-11-04  7:23 UTC (permalink / raw)
  To: zsh-workers; +Cc: Danek Duvall

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Friday 04 November 2005 05:22, Danek Duvall wrote:
> I've been meaning to write some completion functions for Solaris-specific
> utilities

pkg* suite is not Solaris specific (though specific arguments are of course) 
and is used in SVR4 based systems. I admit that the only survivied one is 
probably Solaris.

> and get them added to the zsh distribution if at all possible. 

I'd put it in more general directory then Solaris; I'd like to check usage 
against systems I still have access to.

Thank you for writing them.

- -andrey
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)

iD8DBQFDawx0R6LMutpd94wRAmVFAKCqwClI7bZ6RbfkYZWjGF1FB4MUMwCghyjZ
DKjUhz7dTf7YqCbH9pJ5STo=
=ORdT
-----END PGP SIGNATURE-----


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: PATCH: _pkg* completion for Solaris
  2005-11-04  7:23 ` Andrey Borzenkov
@ 2005-11-04  8:04   ` Danek Duvall
  0 siblings, 0 replies; 3+ messages in thread
From: Danek Duvall @ 2005-11-04  8:04 UTC (permalink / raw)
  To: Andrey Borzenkov; +Cc: zsh-workers

On Fri, Nov 04, 2005 at 10:23:29AM +0300, Andrey Borzenkov wrote:

> pkg* suite is not Solaris specific (though specific arguments are of
> course) and is used in SVR4 based systems. I admit that the only
> survivied one is probably Solaris.

Fair enough.  If there's a good way of separating out the SVr4 bits from
the Solaris-specific bits, I'm happy to do that, but I definitely don't
want to dump it all into something labeled SVr4 just for someone to find
they can't actually use it.

Any ideas on what we should do about that?  It could be in a more general
directory, and have a test to see if it's Solaris, adding the Solaris-
specific bits if so ... would that work for you?

> I'd put it in more general directory then Solaris; I'd like to check usage 
> against systems I still have access to.

Okay; I'm definitely curious to see how general some of the Solaris
commands are w.r.t. other SVr4 systems are.

> Thank you for writing them.

You're quite welcome.  Thanks for the review.

Danek


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2005-11-04  8:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-11-04  2:22 PATCH: _pkg* completion for Solaris Danek Duvall
2005-11-04  7:23 ` Andrey Borzenkov
2005-11-04  8:04   ` Danek Duvall

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).