From owner-freebsd-ports@FreeBSD.ORG Thu Oct 18 16:50:13 2012 Return-Path: Delivered-To: freebsd-ports@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 56048845 for ; Thu, 18 Oct 2012 16:50:13 +0000 (UTC) (envelope-from ume@mahoroba.org) Received: from mail.mahoroba.org (ent.mahoroba.org [IPv6:2001:2f0:104:8010::1]) by mx1.freebsd.org (Postfix) with ESMTP id 181E38FC12 for ; Thu, 18 Oct 2012 16:50:10 +0000 (UTC) Received: from yuga.mahoroba.org (ume@yuga.mahoroba.org [IPv6:2001:2f0:104:8010:7258:12ff:fe22:d94b]) (user=ume mech=DIGEST-MD5 bits=0) by mail.mahoroba.org (8.14.5/8.14.5) with ESMTP/inet6 id q9IGntre070338 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Fri, 19 Oct 2012 01:49:58 +0900 (JST) (envelope-from ume@mahoroba.org) Date: Fri, 19 Oct 2012 01:49:54 +0900 Message-ID: From: Hajimu UMEMOTO To: gtodd@bellanet.org Subject: Re: zsh/pkg - solaris completions used for pkgNG In-Reply-To: References: User-Agent: xcite1.60> Wanderlust/2.15.9 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (=?ISO-2022-JP-2?B?R29qGyQoRCtXGyhC?=) APEL/10.8 Emacs/24.2 (i386-portbld-freebsd9.1) MULE/6.0 (HANACHIRUSATO) X-Operating-System: FreeBSD 9.1-PRERELEASE X-PGP-Key: http://www.mahoroba.org/~ume/publickey.asc X-PGP-Fingerprint: 1F00 0B9E 2164 70FC 6DC5 BF5F 04E9 F086 BF90 71FE MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: multipart/mixed; boundary="Multipart_Fri_Oct_19_01:49:54_2012-1" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (mail.mahoroba.org [IPv6:2001:2f0:104:8010::1]); Fri, 19 Oct 2012 01:49:58 +0900 (JST) X-Virus-Scanned: clamav-milter 0.97.6 at asuka.mahoroba.org X-Virus-Status: Clean X-Spam-Status: No, score=-5.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on asuka.mahoroba.org Cc: FreeBSD Ports X-BeenThere: freebsd-ports@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Porting software to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Oct 2012 16:50:13 -0000 --Multipart_Fri_Oct_19_01:49:54_2012-1 Content-Type: text/plain; charset=US-ASCII Hi, >>>>> On Thu, 18 Oct 2012 11:07:20 -0400 (EDT) >>>>> gtodd@bellanet.org said: gtodd> A fix is to write completion for pkgNG one day ;-) or, for now, to gtodd> simply remove that file from the zsh port. My guess is the _pkg5 gtodd> functions can be hacked a bit to fit the needs of a very simple pkgNG gtodd> but I haven't started doing that yet. I was getting annoyed by this issue, too. So, I'm writing a completion for pkgNG. I've attached it for your interest. It is far from complete, though. Further work is welcome. :-) Sincerely, --Multipart_Fri_Oct_19_01:49:54_2012-1 Content-Type: application/octet-stream Content-Disposition: attachment; filename="_pkgng" Content-Transfer-Encoding: 7bit #compdef pkg _pkgng_pkgs() { local _pkgng_installed_pkgs _pkgng_installed_pkgs=($(pkg info -aq)) _describe -t packages "installed ports" _pkgng_installed_pkgs } _pkgng_ports() { _files -X "%Bports%b" -W "${PORTSDIR:-/usr/ports}" -/ } _pkgng_pkgs_ports() { local _pkgng_installed_pkgs local array ret=1 _tags packages ports while _tags; do if _requested packages; then _pkgng_installed_pkgs=($(pkg info -aq)) _describe -t packages "installed ports" _pkgng_installed_pkgs && ret=0 fi if _requested ports; then _files -X "%Bports%b" -W "${PORTSDIR:-/usr/ports}" -/ && ret=0 fi (( ret )) || return ret done } _pkgng() { local expl local -a subcmds subcmds=( add audit autoremove backup check clean create delete fetch help info install query register remove repo rquery search set shell shlib stats update updating upgrade version which ) if [[ $service == "pkg" ]]; then _arguments -C -A "-*" \ '-d[Increment debug level]' \ '-j[Execute pkg(1) inside a jail(8)]:jail name or id: ' \ '-c[Execute pkg(1) inside a chroot(8)]:chroot path:_path_files -/' \ '-v[Display pkg(1) version]' \ '*::command:->subcmd' && return 0 if (( CURRENT == 1 )); then _wanted commands expl "pkg subcommand" compadd -a subcmds return fi service="$words[1]" fi case $service in ("add") _arguments \ '*:package name:_files' ;; ("audit") _arguments -A "-*" \ '-F[Fetch the database before checking.]' \ '-q[Be "quiet". Prints only the requested information without displaying many hints.]' ;; ("autoremove") _arguments -A "-*" \ '-y[Assume yes when asked for confirmation before package autoremoval.]' \ '-n[Dry-run mode. The list of changes to packages is always printed, but no changes are actually made.]' \ '-q[Force quiet output]' ;; ("backup") ;; ("check") _arguments -A "-*" \ '-B[reanalyse SHLIBS of installed packages.]' \ '-d[check for and install missing dependencies.]' \ '-r[recompute sizes and checksums of installed packages.]' \ '-s[find invalid checksums for installed packages.]' \ \ '-y[Assume yes when asked for confirmation before installing missing dependencies.]' \ '-v[Be verbose.]' \ '-a[Process all packages.]' \ '-g[Treat as a shell glob pattern.]' \ '-x[Treat as a regular expression.]' \ '-X[Treat as an extended regular expression.]' ;; ("clean") ;; ("create") ;; ("delete") _arguments -A "-*" \ '-a[Deletes all installed packages from the system and empties the database.]' \ '-f[Forces packages to be removed despite leaving unresolved dependencies.]' \ '-g[Treat the package names as shell glob patterns.]' \ '-n[Dry run mode. The list of packages to delete is always printed, but no packages are actually deleted.]' \ '-q[Force quiet output, except where -n is also used, when pkg delete will show the list of packages to be deleted.]' \ '-R[Delete all packages that require the listed packages as well.]' \ '-X[Treat the package names as extended regular expressions.]' \ '-x[Treat the package names as regular expressions.]' \ '-y[Assume yes when asked for confirmation before package deletion.]' \ '*:package:_pkgng_pkgs' ;; ("fetch") ;; ("help") _arguments -s \ ':command:_values -S " " -w "commands" $subcmds[@]' ;; ("info") _arguments -A "-*" \ '-a[Display all installed packages.]' \ '-f[Display full information about the packages matching .]' \ '-R[Display the full yaml (raw) about the packages matching .]' \ '-e[If is installed and registered in the database, return 0, otherwise return 1. Useful for checking whether the package is installed.]' \ '-D[Show the pkg-message for matching packages.]' \ '-g[Treat as a shell glob pattern.]' \ '-x[Treat as a regular expression.]' \ '-X[Treat as an extended regular expression.]' \ '-d[Display the list of packages required by .]' \ '-r[Display the list of packages which depend on .]' \ '-l[Display all files installed by .]' \ '-B[Display all shared libraries used by .]' \ '-s[Display the total size of files installed by ]' \ '-q[Be "quiet". Prints only the requested information without displaying many hints.]' \ '-O[Search is done by the origin. Added only for Ports compatibility.]' \ '-E[Currently not implemented. Added only for Ports compatibility.]' \ '-o[Display origin.]' \ '-p[Display the installation prefix for each package matching .]' \ '-F[-F Displays information from the package archive .]' \ '*:package:_pkgng_pkgs' ;; ("install") ;; ("query") _arguments -A "-*" \ '-a[Match all packages from the database]' \ '-e[Match packages using the given evaluation-condition.]' \ '-F[Display information only for the package file pkg-name]' \ '-g[Treat as a glob pattern.]' \ '-x[Treat as a regular expression.]' \ '-X[Treat as an extended regular expression.]' \ '*:package:_pkgng_pkgs' ;; ("register") ;; ("remove") _arguments -A "-*" \ '-a[Deletes all installed packages from the system and empties the database.]' \ '-f[Forces packages to be removed despite leaving unresolved dependencies.]' \ '-g[Treat the package names as shell glob patterns.]' \ '-n[Dry run mode. The list of packages to delete is always printed, but no packages are actually deleted.]' \ '-q[Force quiet output, except where -n is also used, when pkg delete will show the list of packages to be deleted.]' \ '-R[Delete all packages that require the listed packages as well.]' \ '-X[Treat the package names as extended regular expressions.]' \ '-x[Treat the package names as regular expressions.]' \ '-y[Assume yes when asked for confirmation before package deletion.]' \ '*:package:_pkgng_pkgs' ;; ("repo") ;; ("rquery") ;; ("search") _arguments -A "-*" \ '-e[Treat pattern as exact pattern]' \ '-g[Treat pattern as a shell glob pattern.]' \ '-x[Treat pattern as a regular expression.]' \ '-X[Treat pattern as an extended regular expression.]' \ '-c[Search for pattern in the package comment one-line description.]' \ '-D[Search for pattern in the package desription.]' \ '-f[Displays full information about the matching packages.]' \ '-d[Displays the dependencies of pattern]' \ '-s[Displays the size of the package]' \ '-q[Be "quiet". Prints only the requested information without displaying many hints.]' \ '-o[Displays pattern origin.]' \ '-p[Displays the installation prefix for each package matching pattern]' \ '*:package:_pkgng_pkgs_ports' ;; ("set") ;; ("shell") ;; ("shlib") _arguments -s \ '*:library:_files' # XXX: ;; ("stats") _arguments -A "-*" \ '-q[Quiet mode. Show less output.]' \ '-l[Display stats only for the local package database.]' \ '-r[Display stats only for the remote package database(s).]' ;; ("update") _arguments -A "-*" \ '-q[Force quiet output]' \ '-f[Force a full download of the repository catalogue without regard to the respective ages of the local and remote copies of the catalogue]' ;; ("updating") _arguments -A "-*" \ '-d[Only entries newer than date are shown.]:date (YYYYMMDD)' \ '-f[Defines a alternative location of the UPDATING file.]:file:_files' \ '*:package:_pkgng_pkgs_ports' ;; ("upgrade") _arguments -A "-*" \ '-f[Force reinstalling/upgrading the whole set of packages]' \ '-L[Skip updating the repository catalogues with pkg-update(8). Use the local cache only.]' \ '-n[Dry-run mode: show what packages have updates available, but do not perform any upgrades. Repository catalogues will be updated as usual unless the -L option is also given.]' \ '-q[Force quiet output, except when -n is used, where pkg upgrade will always print out the list of packages with available updates.]' \ '-y[Assume yes when asked for confirmation before package installation.]' \ '-r[Package repository.]:reponame' \ ;; ("version") ;; ("which") _arguments -A "-*" \ '-q[Be quiet]' \ '-o[Shows the origin of the package instead of name-version]' \ ':file:_files' ;; (*) _message "unknown pkg subcommand: $service" ;; esac } _pkgng "$@" --Multipart_Fri_Oct_19_01:49:54_2012-1 Content-Type: text/plain; charset=US-ASCII --Multipart_Fri_Oct_19_01:49:54_2012-1 Content-Type: text/plain -- Hajimu UMEMOTO ume@mahoroba.org ume@{,jp.}FreeBSD.org http://www.mahoroba.org/~ume/ --Multipart_Fri_Oct_19_01:49:54_2012-1--