Radish alpha
H
rad:z3QDZAW2FAfuLvihrhiyDC9fAD8G9
HardenedBSD Package Manager
Radicle
Git
Install back zsh completion as _zsh to please most users
Baptiste Daroussin committed 11 years ago
commit 49c02135ef62bd3f84342b9880ffd17607e115c0
parent 49fec7d
4 files changed +310 -310
modified configure.ac
@@ -308,7 +308,7 @@ AC_CONFIG_FILES(Makefile \
		scripts/periodic/490.status-pkg-changes
		scripts/sbin/pkg2ng
		scripts/completion/_pkg.bash
-
		scripts/completion/_pkg.zsh)
+
		scripts/completion/_pkg)
AC_CONFIG_FILES(m4_expand([repos_makefiles]))

AC_CONFIG_HEADERS(pkg_config.h)
modified scripts/Makefile.am
@@ -11,4 +11,4 @@ dist_psecurity_DATA= periodic/410.pkg-audit \
			periodic/460.pkg-checksum
dist_pweekly_DATA=	periodic/400.status-pkg
dist_bashcomp_DATA=	completion/_pkg.bash
-
dist_zshcomp_DATA=	completion/_pkg.zsh
+
dist_zshcomp_DATA=	completion/_pkg
added scripts/completion/_pkg.in
@@ -0,0 +1,308 @@
+
#compdef pkg
+

+
_pkg_installed() {
+
	compadd "$@" - $(@prefix@/sbin/pkg query "%n-%v")
+
}
+

+
_pkg_available_name() {
+
	compadd "$@" - $(@prefix@/sbin/pkg rquery "%n")
+
}
+

+
_pkg_available() {
+
	compadd "$@" - $(@prefix@/sbin/pkg rquery "%n-%v")
+
}
+

+
_pkg() {
+
	local earlyargs subcmd
+
	local subcmd_list cmd
+
	earlyargs=(
+
	'-d[Increment debug level]'
+
	'-j[Execute pkg(8) inside a jail(8)]:jail:'
+
	'-c[Execute pkg(8) inside a chroot(8)]:chroot:_files -/'
+
	'-C[Use the specified configuration file]'
+
	'-l[List available command and exit]'
+
	'-v[Display pkg(8) version]'
+
	'-N[Test if pkg(8) is activated and avoid auto-activation]'
+
	)
+

+
	subcmd=(
+
		'add[Registers a package and installs it on the system]'
+
		'audit[Reports vulnerable packages]'
+
		'autoremove[Removes orphan packages]'
+
		'backup[Backs-up and restores the local package database]'
+
		'check[Checks for missing dependencies and database consistency]'
+
		'clean[Cleans old packages from the cache]'
+
		'convert[Convert database from/to pkgng]'
+
		'create[Creates software package distributions]'
+
		'delete[Deletes packages from the database and the system]'
+
		'fetch[Fetches packages from a remote repository]'
+
		'help[Displays help information]'
+
		'info[Displays information about installed packages]'
+
		'install[Installs packages from remote package repositories]'
+
		'query[Queries information about installed packages]'
+
		'register[Registers a package into the local database]'
+
		'remove[Deletes packages from the database and the system]'
+
		'repo[Creates a package repository catalogue]'
+
		'rquery[Queries information in repository catalogues]'
+
		'search[Performs a search of package repository catalogues]'
+
		'set[Modifies information about packages in the local database]'
+
		'shell[Opens a debug shell]'
+
		'shlib[Displays which packages link against a specific shared library]'
+
		'stats[Displays package database statistics]'
+
		'update[Updates package repository catalogues]'
+
		'updating[Displays UPDATING information for a package]'
+
		'upgrade[Performs upgrades of packaged software distributions]'
+
		'version[Displays the versions of installed packages]'
+
		'which[Displays which package installed a specific file]'
+
	)
+

+
	if [[ $service = "pkg" ]]; then
+

+
		_arguments -C -A "-*" \
+
			$earlyargs \
+
			'*::command:->subcmd' && return 0
+

+
		if (( CURRENT == 1 )); then
+
			_values 'pkg subcommands' \
+
				$subcmd && return 0
+
			return 0
+
		fi
+
		service="$words[1]"
+
		curcontext="${curcontext%:*}=$service:"
+
	fi
+

+
	case $service in
+
		(add) _arguments -A 'package' \
+
			'*:package:_files -g "*.t?z"' && return 0
+
			;;
+
		(audit)
+
			_arguments -s \
+
				'-F[Fetch the database before checking.]' \
+
				'-q[Quiet]' \
+
				'*:package:_pkg_installed' \
+
				&& return 0
+
			;;
+
		(autoremove)
+
			_arguments -s \
+
				'(-n)-y[Assume yes when asked for confirmation]' \
+
				'(-y)-n[Assume no (dry run) when asked for confirmation]' \
+
				&& return 0
+
			;;
+
		(backup)
+
			_arguments -s \
+
				'(-r)-d[Dumps the local package database]:destination:_files' \
+
				'(-d)-r[Restore the local package database]:destination:_files' \
+
				&& return 0
+
			;;
+
		(check)
+
			_arguments -s \
+
				'-B[reanalyze the shared libraries]' \
+
				'-d[check for and install missing dependencies]' \
+
				'-r[recompute sizes and checksums of installed]' \
+
				'-s[find invalid checksums]' \
+
				'-v[Be verbose]' \
+
				'(-g -x -X)-a[Process all packages]' \
+
				'(-x -X -a)-g[Process packages that match the glob pattern]:glob pattern:' \
+
				'(-g -X -a)-x[Process packages that match the regex pattern]:regex pattern:' \
+
				'(-g -x -a)-X[Process packages that match the extended regex pattern]:extended regex pattern:' \
+
				&& return 0
+
			;;
+
		(clean)
+
			return 0
+
			;;
+
		(convert)
+
			_arguments -s \
+
				'-r[Revert conversion]' \
+
				&& return 0
+
			;;
+
		(create)
+
			_arguments -s \
+
				'-r[Root directory]:rootdir:_files -/' \
+
				'-m[Manifest directory]:manifestdir:_files -/' \
+
				'-f[format]:format:((tar tgz tbz txz))' \
+
				'-o[Ouput directory]:outdir:_files -/' \
+
				'(-g -x -X)-a[Process all packages]' \
+
				'(-x -X -a)-g[Process packages that match the glob pattern]:glob pattern:' \
+
				'(-g -X -a)-x[Process packages that match the regex pattern]:regex pattern:' \
+
				'(-g -x -a)-X[Process packages that match the extended regex pattern]:extended regex pattern:' \
+
				'*:Package:_pkg_installed' \
+
				&& return 0
+
			;;
+
		(delete|remove)
+
			_arguments -s \
+
				'(-n)-y[Assume yes when asked for confirmation]' \
+
				'(-y)-n[Assume no (dry run) when asked for confirmation]' \
+
				'-f[Force the package(s) to be removed]' \
+
				'(-g -x -X)-a[Process all packages]' \
+
				'(-x -X -a)-g[Process packages that match the glob pattern]:glob pattern:' \
+
				'(-g -X -a)-x[Process packages that match the regex pattern]:regex pattern:' \
+
				'(-g -x -a)-X[Process packages that match the extended regex pattern]:extended regex pattern:' \
+
				'*:Package:_pkg_installed' \
+
				&& return 0
+
			;;
+
		(fetch)
+
			_arguments -s \
+
				'-y[Assume yes when asked for confirmation]' \
+
				'-L[Do not try to update the repository metadata]' \
+
				'-q[Be quiet]' \
+
				'(-g -x -X)-a[Process all packages]' \
+
				'(-x -X -a)-g[Process packages that match the glob pattern]:glob pattern:' \
+
				'(-g -X -a)-x[Process packages that match the regex pattern]:regex pattern:' \
+
				'(-g -x -a)-X[Process packages that match the extended regex pattern]:extended regex pattern:' \
+
				'*:Available packages:_pkg_available' \
+
				&& return 0
+
			;;
+
		(help)
+
			_arguments -s \
+
				':command:_values -S " " -w "pkg subcommands" ${subcmd/\[*/}'
+
			return 0
+
			;;
+
		(info)
+
			_arguments -s \
+
				'(-e -d -r -l -o -p -D)-f[Displays full information]' \
+
				'(-f -d -r -l -o -p -D)-e[Returns 0 if <pkg-name> is installed]' \
+
				'(-e -f -r -l -o -p -D)-d[Displays the dependencies]' \
+
				'(-e -d -f -l -o -p -D)-r[Displays the reverse dependencies]' \
+
				'(-e -d -r -f -o -p -D)-l[Displays all files]' \
+
				'(-e -d -r -l -f -p -D)-o[Displays origin]' \
+
				'(-e -d -r -l -o -f -D)-p[Displays prefix]' \
+
				'(-e -d -r -l -o -p -f)-D[Displays message]' \
+
				'-q[Be quiet]' \
+
				'(-g -x -X -F)-a[Process all packages]' \
+
				'(-x -X -a -F)-g[Process packages that match the glob pattern]:glob pattern:' \
+
				'(-g -X -a -F)-x[Process packages that match the regex pattern]:regex pattern:' \
+
				'(-g -x -a -F)-X[Process packages that match the extended regex pattern]:extended regex pattern:' \
+
				'(-g -x -X -a)-F[Process the specified package]:package:_files -g "*.t?z"' \
+
				'*:Package:_pkg_installed' \
+
				&& return 0
+
			;;
+
		(install)
+
			_arguments -s \
+
				'(-n)-y[Assume yes when asked for confirmation]' \
+
				'(-y)-n[Assume no (dry run) when asked for confirmation]' \
+
				'-f[Force reinstallation if needed]' \
+
				'-R[Reinstall every package depending on matching expressions]' \
+
				'-L[Do not try to update the repository metadata]' \
+
				'(-x -X)-g[Process packages that match the glob pattern]:glob pattern:' \
+
				'(-g -X)-x[Process packages that match the regex pattern]:regex pattern:' \
+
				'(-g -x)-X[Process packages that match the extended regex pattern]:extended regex pattern:' \
+
				'*:Available packages:_pkg_available' \
+
				&& return 0
+
			;;
+
		(query)
+
			_arguments -s \
+
				'(-g -x -X -F -e)-a[Process all packages]' \
+
				'(-x -X -a -F -e)-g[Process packages that match the glob pattern]:glob pattern:' \
+
				'(-g -X -a -F -e)-x[Process packages that match the regex pattern]:regex pattern:' \
+
				'(-g -x -a -F -e)-X[Process packages that match the extended regex pattern]:extended regex pattern:' \
+
				'(-g -x -X -a -F)-e[Process packages that match the evaluation]:evaluation:' \
+
				'(-g -x -X -a -e)-F[Process the specified package]:package:_files -g "*.t?z"' \
+
				':Ouput format:' \
+
				&& return 0
+
			;;
+
		(register)
+
			_arguments -s \
+
				'-l[register as a legacy format]' \
+
				'-d[mark the package as an automatic dependency]' \
+
				'-f[packing list file]:packing list file:_files' \
+
				'-m[metadata directory]:metadatadir:_files -/' \
+
				'-a[ABI]:abi:' \
+
				'-i[input path (aka root directory)]:input path:_files -/' \
+
				&& return 0
+
			;;
+
		(repo)
+
			_arguments -s \
+
				':Repository path:_files -/' \
+
				':RSA key:_files' \
+
				&& return 0
+
			;;
+
		(rquery)
+
			_arguments -s \
+
				'(-g -x -X -e)-a[Process all packages]' \
+
				'(-x -X -a -e)-g[Process packages that match the glob pattern]:glob pattern:' \
+
				'(-g -X -a -e)-x[Process packages that match the regex pattern]:regex pattern:' \
+
				'(-g -x -a -e)-X[Process packages that match the extended regex pattern]:extended regex pattern:' \
+
				'(-g -x -X -a)-e[Process packages that match the evaluation]:evaluation:' \
+
				':Ouput format:' \
+
				&& return 0
+
			;;
+
		(search)
+
			_arguments -s \
+
				'(-x -X)-g[Process packages that match the glob pattern]:glob pattern:' \
+
				'(-g -X)-x[Process packages that match the regex pattern]:regex pattern:' \
+
				'(-g -x)-X[Process packages that match the extended regex pattern]:extended regex pattern:' \
+
				'*:Available packages:_pkg_available_name' \
+
				&& return 0
+
			;;
+
		(set)
+
			_arguments -s \
+
				'(-o)-A[Mark as automatic or not]:flag:((1\:automatic 0\:not\ automatic))' \
+
				'(-A)-o[Change the origin]:oldorigin\:neworigin:' \
+
				'-y[Assume yes when asked for confirmation]' \
+
				'(-g -x -X)-a[Process all packages]' \
+
				'(-x -X -a)-g[Process packages that match the glob pattern]:glob pattern:' \
+
				'(-g -X -a)-x[Process packages that match the regex pattern]:regex pattern:' \
+
				'(-g -x -a)-X[Process packages that match the extended regex pattern]:extended regex pattern:' \
+
				'*:Package:_pkg_installed'
+
			return 0
+
			;;
+
		(shell)
+
			_arguments -s \
+
				':database:_files' \
+
				&& return 0
+
			;;
+
		(shlib)
+
			_arguments -s \
+
				':Library:' \
+
				&& return 0
+
			;;
+
		(stats)
+
			_arguments -s \
+
				'-q[Be quiet]' \
+
				'(-l)-r[Display stats only for the local package database]' \
+
				'(-r)-l[Display stats only for the remote package database(s)]' \
+
				&& return 0
+
			;;
+
		(update)
+
			_arguments -s \
+
				'-f[Force update]' \
+
				'-q[Be quiet]' \
+
				&& return 0
+
			;;
+
		(updating)
+
			_arguments -s \
+
				'-d[Only entries newer than date are shown]:date:' \
+
				'-f[Defines a alternative location of the UPDATING file]:UPDATING file:_files' \
+
				'*:Package:_pkg_installed' \
+
				&& return 0
+
			;;
+
		(upgrade)
+
			_arguments -s \
+
				'(-y)-n[Assume no (dry run) when asked for confirmation]' \
+
				'(-n)-y[Assume yes when asked for confirmation]' \
+
				'-f[Upgrade/Reinstall everything]' \
+
				'-L[Do not try to update the repository metadata]' \
+
				&& return 1
+
			;;
+
		(version)
+
			#TODO: complete
+
			_arguments -s \
+
				'(-P -R)-I[Use INDEX file]' \
+
				'(-R -I)-P[Force checking against the ports tree]' \
+
				'(-I -P)-R[Use remote repository]' \
+
				'-o[Display package origin, instead of package name]' \
+
				'-q[Be quiet]' \
+
				'-v[Be verbose]' \
+
				'(-L)-l[Display only the packages with a given status flag]:flag:((\< = \>))' \
+
				'(-l)-L[Display only the packages without a given status flag]:flag:((\< = \>))' \
+
				&& return 0
+
			;;
+
		(which)
+
			_arguments -s \
+
				':file:_files' \
+
			&& return 0
+
			;;
+
	esac
+
}
+

+
_pkg "$@"
deleted scripts/completion/_pkg.zsh.in
@@ -1,308 +0,0 @@
-
#compdef pkg
-

-
_pkg_installed() {
-
	compadd "$@" - $(@prefix@/sbin/pkg query "%n-%v")
-
}
-

-
_pkg_available_name() {
-
	compadd "$@" - $(@prefix@/sbin/pkg rquery "%n")
-
}
-

-
_pkg_available() {
-
	compadd "$@" - $(@prefix@/sbin/pkg rquery "%n-%v")
-
}
-

-
_pkg() {
-
	local earlyargs subcmd
-
	local subcmd_list cmd
-
	earlyargs=(
-
	'-d[Increment debug level]'
-
	'-j[Execute pkg(8) inside a jail(8)]:jail:'
-
	'-c[Execute pkg(8) inside a chroot(8)]:chroot:_files -/'
-
	'-C[Use the specified configuration file]'
-
	'-l[List available command and exit]'
-
	'-v[Display pkg(8) version]'
-
	'-N[Test if pkg(8) is activated and avoid auto-activation]'
-
	)
-

-
	subcmd=(
-
		'add[Registers a package and installs it on the system]'
-
		'audit[Reports vulnerable packages]'
-
		'autoremove[Removes orphan packages]'
-
		'backup[Backs-up and restores the local package database]'
-
		'check[Checks for missing dependencies and database consistency]'
-
		'clean[Cleans old packages from the cache]'
-
		'convert[Convert database from/to pkgng]'
-
		'create[Creates software package distributions]'
-
		'delete[Deletes packages from the database and the system]'
-
		'fetch[Fetches packages from a remote repository]'
-
		'help[Displays help information]'
-
		'info[Displays information about installed packages]'
-
		'install[Installs packages from remote package repositories]'
-
		'query[Queries information about installed packages]'
-
		'register[Registers a package into the local database]'
-
		'remove[Deletes packages from the database and the system]'
-
		'repo[Creates a package repository catalogue]'
-
		'rquery[Queries information in repository catalogues]'
-
		'search[Performs a search of package repository catalogues]'
-
		'set[Modifies information about packages in the local database]'
-
		'shell[Opens a debug shell]'
-
		'shlib[Displays which packages link against a specific shared library]'
-
		'stats[Displays package database statistics]'
-
		'update[Updates package repository catalogues]'
-
		'updating[Displays UPDATING information for a package]'
-
		'upgrade[Performs upgrades of packaged software distributions]'
-
		'version[Displays the versions of installed packages]'
-
		'which[Displays which package installed a specific file]'
-
	)
-

-
	if [[ $service = "pkg" ]]; then
-

-
		_arguments -C -A "-*" \
-
			$earlyargs \
-
			'*::command:->subcmd' && return 0
-

-
		if (( CURRENT == 1 )); then
-
			_values 'pkg subcommands' \
-
				$subcmd && return 0
-
			return 0
-
		fi
-
		service="$words[1]"
-
		curcontext="${curcontext%:*}=$service:"
-
	fi
-

-
	case $service in
-
		(add) _arguments -A 'package' \
-
			'*:package:_files -g "*.t?z"' && return 0
-
			;;
-
		(audit)
-
			_arguments -s \
-
				'-F[Fetch the database before checking.]' \
-
				'-q[Quiet]' \
-
				'*:package:_pkg_installed' \
-
				&& return 0
-
			;;
-
		(autoremove)
-
			_arguments -s \
-
				'(-n)-y[Assume yes when asked for confirmation]' \
-
				'(-y)-n[Assume no (dry run) when asked for confirmation]' \
-
				&& return 0
-
			;;
-
		(backup)
-
			_arguments -s \
-
				'(-r)-d[Dumps the local package database]:destination:_files' \
-
				'(-d)-r[Restore the local package database]:destination:_files' \
-
				&& return 0
-
			;;
-
		(check)
-
			_arguments -s \
-
				'-B[reanalyze the shared libraries]' \
-
				'-d[check for and install missing dependencies]' \
-
				'-r[recompute sizes and checksums of installed]' \
-
				'-s[find invalid checksums]' \
-
				'-v[Be verbose]' \
-
				'(-g -x -X)-a[Process all packages]' \
-
				'(-x -X -a)-g[Process packages that match the glob pattern]:glob pattern:' \
-
				'(-g -X -a)-x[Process packages that match the regex pattern]:regex pattern:' \
-
				'(-g -x -a)-X[Process packages that match the extended regex pattern]:extended regex pattern:' \
-
				&& return 0
-
			;;
-
		(clean)
-
			return 0
-
			;;
-
		(convert)
-
			_arguments -s \
-
				'-r[Revert conversion]' \
-
				&& return 0
-
			;;
-
		(create)
-
			_arguments -s \
-
				'-r[Root directory]:rootdir:_files -/' \
-
				'-m[Manifest directory]:manifestdir:_files -/' \
-
				'-f[format]:format:((tar tgz tbz txz))' \
-
				'-o[Ouput directory]:outdir:_files -/' \
-
				'(-g -x -X)-a[Process all packages]' \
-
				'(-x -X -a)-g[Process packages that match the glob pattern]:glob pattern:' \
-
				'(-g -X -a)-x[Process packages that match the regex pattern]:regex pattern:' \
-
				'(-g -x -a)-X[Process packages that match the extended regex pattern]:extended regex pattern:' \
-
				'*:Package:_pkg_installed' \
-
				&& return 0
-
			;;
-
		(delete|remove)
-
			_arguments -s \
-
				'(-n)-y[Assume yes when asked for confirmation]' \
-
				'(-y)-n[Assume no (dry run) when asked for confirmation]' \
-
				'-f[Force the package(s) to be removed]' \
-
				'(-g -x -X)-a[Process all packages]' \
-
				'(-x -X -a)-g[Process packages that match the glob pattern]:glob pattern:' \
-
				'(-g -X -a)-x[Process packages that match the regex pattern]:regex pattern:' \
-
				'(-g -x -a)-X[Process packages that match the extended regex pattern]:extended regex pattern:' \
-
				'*:Package:_pkg_installed' \
-
				&& return 0
-
			;;
-
		(fetch)
-
			_arguments -s \
-
				'-y[Assume yes when asked for confirmation]' \
-
				'-L[Do not try to update the repository metadata]' \
-
				'-q[Be quiet]' \
-
				'(-g -x -X)-a[Process all packages]' \
-
				'(-x -X -a)-g[Process packages that match the glob pattern]:glob pattern:' \
-
				'(-g -X -a)-x[Process packages that match the regex pattern]:regex pattern:' \
-
				'(-g -x -a)-X[Process packages that match the extended regex pattern]:extended regex pattern:' \
-
				'*:Available packages:_pkg_available' \
-
				&& return 0
-
			;;
-
		(help)
-
			_arguments -s \
-
				':command:_values -S " " -w "pkg subcommands" ${subcmd/\[*/}'
-
			return 0
-
			;;
-
		(info)
-
			_arguments -s \
-
				'(-e -d -r -l -o -p -D)-f[Displays full information]' \
-
				'(-f -d -r -l -o -p -D)-e[Returns 0 if <pkg-name> is installed]' \
-
				'(-e -f -r -l -o -p -D)-d[Displays the dependencies]' \
-
				'(-e -d -f -l -o -p -D)-r[Displays the reverse dependencies]' \
-
				'(-e -d -r -f -o -p -D)-l[Displays all files]' \
-
				'(-e -d -r -l -f -p -D)-o[Displays origin]' \
-
				'(-e -d -r -l -o -f -D)-p[Displays prefix]' \
-
				'(-e -d -r -l -o -p -f)-D[Displays message]' \
-
				'-q[Be quiet]' \
-
				'(-g -x -X -F)-a[Process all packages]' \
-
				'(-x -X -a -F)-g[Process packages that match the glob pattern]:glob pattern:' \
-
				'(-g -X -a -F)-x[Process packages that match the regex pattern]:regex pattern:' \
-
				'(-g -x -a -F)-X[Process packages that match the extended regex pattern]:extended regex pattern:' \
-
				'(-g -x -X -a)-F[Process the specified package]:package:_files -g "*.t?z"' \
-
				'*:Package:_pkg_installed' \
-
				&& return 0
-
			;;
-
		(install)
-
			_arguments -s \
-
				'(-n)-y[Assume yes when asked for confirmation]' \
-
				'(-y)-n[Assume no (dry run) when asked for confirmation]' \
-
				'-f[Force reinstallation if needed]' \
-
				'-R[Reinstall every package depending on matching expressions]' \
-
				'-L[Do not try to update the repository metadata]' \
-
				'(-x -X)-g[Process packages that match the glob pattern]:glob pattern:' \
-
				'(-g -X)-x[Process packages that match the regex pattern]:regex pattern:' \
-
				'(-g -x)-X[Process packages that match the extended regex pattern]:extended regex pattern:' \
-
				'*:Available packages:_pkg_available' \
-
				&& return 0
-
			;;
-
		(query)
-
			_arguments -s \
-
				'(-g -x -X -F -e)-a[Process all packages]' \
-
				'(-x -X -a -F -e)-g[Process packages that match the glob pattern]:glob pattern:' \
-
				'(-g -X -a -F -e)-x[Process packages that match the regex pattern]:regex pattern:' \
-
				'(-g -x -a -F -e)-X[Process packages that match the extended regex pattern]:extended regex pattern:' \
-
				'(-g -x -X -a -F)-e[Process packages that match the evaluation]:evaluation:' \
-
				'(-g -x -X -a -e)-F[Process the specified package]:package:_files -g "*.t?z"' \
-
				':Ouput format:' \
-
				&& return 0
-
			;;
-
		(register)
-
			_arguments -s \
-
				'-l[register as a legacy format]' \
-
				'-d[mark the package as an automatic dependency]' \
-
				'-f[packing list file]:packing list file:_files' \
-
				'-m[metadata directory]:metadatadir:_files -/' \
-
				'-a[ABI]:abi:' \
-
				'-i[input path (aka root directory)]:input path:_files -/' \
-
				&& return 0
-
			;;
-
		(repo)
-
			_arguments -s \
-
				':Repository path:_files -/' \
-
				':RSA key:_files' \
-
				&& return 0
-
			;;
-
		(rquery)
-
			_arguments -s \
-
				'(-g -x -X -e)-a[Process all packages]' \
-
				'(-x -X -a -e)-g[Process packages that match the glob pattern]:glob pattern:' \
-
				'(-g -X -a -e)-x[Process packages that match the regex pattern]:regex pattern:' \
-
				'(-g -x -a -e)-X[Process packages that match the extended regex pattern]:extended regex pattern:' \
-
				'(-g -x -X -a)-e[Process packages that match the evaluation]:evaluation:' \
-
				':Ouput format:' \
-
				&& return 0
-
			;;
-
		(search)
-
			_arguments -s \
-
				'(-x -X)-g[Process packages that match the glob pattern]:glob pattern:' \
-
				'(-g -X)-x[Process packages that match the regex pattern]:regex pattern:' \
-
				'(-g -x)-X[Process packages that match the extended regex pattern]:extended regex pattern:' \
-
				'*:Available packages:_pkg_available_name' \
-
				&& return 0
-
			;;
-
		(set)
-
			_arguments -s \
-
				'(-o)-A[Mark as automatic or not]:flag:((1\:automatic 0\:not\ automatic))' \
-
				'(-A)-o[Change the origin]:oldorigin\:neworigin:' \
-
				'-y[Assume yes when asked for confirmation]' \
-
				'(-g -x -X)-a[Process all packages]' \
-
				'(-x -X -a)-g[Process packages that match the glob pattern]:glob pattern:' \
-
				'(-g -X -a)-x[Process packages that match the regex pattern]:regex pattern:' \
-
				'(-g -x -a)-X[Process packages that match the extended regex pattern]:extended regex pattern:' \
-
				'*:Package:_pkg_installed'
-
			return 0
-
			;;
-
		(shell)
-
			_arguments -s \
-
				':database:_files' \
-
				&& return 0
-
			;;
-
		(shlib)
-
			_arguments -s \
-
				':Library:' \
-
				&& return 0
-
			;;
-
		(stats)
-
			_arguments -s \
-
				'-q[Be quiet]' \
-
				'(-l)-r[Display stats only for the local package database]' \
-
				'(-r)-l[Display stats only for the remote package database(s)]' \
-
				&& return 0
-
			;;
-
		(update)
-
			_arguments -s \
-
				'-f[Force update]' \
-
				'-q[Be quiet]' \
-
				&& return 0
-
			;;
-
		(updating)
-
			_arguments -s \
-
				'-d[Only entries newer than date are shown]:date:' \
-
				'-f[Defines a alternative location of the UPDATING file]:UPDATING file:_files' \
-
				'*:Package:_pkg_installed' \
-
				&& return 0
-
			;;
-
		(upgrade)
-
			_arguments -s \
-
				'(-y)-n[Assume no (dry run) when asked for confirmation]' \
-
				'(-n)-y[Assume yes when asked for confirmation]' \
-
				'-f[Upgrade/Reinstall everything]' \
-
				'-L[Do not try to update the repository metadata]' \
-
				&& return 1
-
			;;
-
		(version)
-
			#TODO: complete
-
			_arguments -s \
-
				'(-P -R)-I[Use INDEX file]' \
-
				'(-R -I)-P[Force checking against the ports tree]' \
-
				'(-I -P)-R[Use remote repository]' \
-
				'-o[Display package origin, instead of package name]' \
-
				'-q[Be quiet]' \
-
				'-v[Be verbose]' \
-
				'(-L)-l[Display only the packages with a given status flag]:flag:((\< = \>))' \
-
				'(-l)-L[Display only the packages without a given status flag]:flag:((\< = \>))' \
-
				&& return 0
-
			;;
-
		(which)
-
			_arguments -s \
-
				':file:_files' \
-
			&& return 0
-
			;;
-
	esac
-
}
-

-
_pkg "$@"