summaryrefslogtreecommitdiff
path: root/shells/zsh/patches/patch-Completion_BSD_Command___bsd__pkg
blob: 282b9fe2fd40eb33ccea2fe834fe15438f12684f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
$NetBSD: patch-Completion_BSD_Command___bsd__pkg,v 1.4 2022/05/16 14:58:30 ryoon Exp $

* Better Darwin support.
* Use pkgsrc PKG_DBDIR as the default database directory.

--- Completion/BSD/Command/_bsd_pkg.orig	2022-05-08 06:18:22.000000000 +0000
+++ Completion/BSD/Command/_bsd_pkg
@@ -15,6 +15,10 @@ _bsd_pkg_pkgfiles() {
     pkgsdir=${${(M)${(f)"$(</etc/mk.conf)"}:#PACKAGE_REPOSITORY*}#*=[[:blank:]]#}
     pkgsdir=${${pkgsdir:-$PACKAGE_REPOSITORY}:-$portsdir/packages/}/$(make -V MACHINE_ARCH)/All
     ;;
+  darwin*)
+    portsdir=/opt/pkgsrc
+    pkgsdir=${PACKAGES:-$portsdir/packages}/All
+    ;;
   *)
     portsdir=${PORTSDIR:-/usr/ports}
     pkgsdir=${PACKAGES:-$portsdir/packages}/All
@@ -31,7 +35,7 @@ _bsd_pkg_pkgfiles() {
 
 (( $+functions[_bsd_pkg_pkgs] )) ||
 _bsd_pkg_pkgs() {
-  compadd "$@" - ${PKG_DBDIR:-/var/db/pkg}/*(/:t)
+  compadd "$@" - ${PKG_DBDIR:-@PKG_DBDIR@}/*(/:t)
 }
 
 (( $+functions[_bsd_pkg_pkgs_and_files] )) ||
@@ -58,7 +62,7 @@ _bsd_pkg() {
     )
 
     case "$OSTYPE" in
-    netbsd*)
+    netbsd*|darwin*)
       flags+=(
         '-A[do not record packages as installed manually]'
         '-C[specify configuration file]:config file:_files'
@@ -139,7 +143,7 @@ _bsd_pkg() {
     )
 
     case "$OSTYPE" in
-    netbsd*)
+    netbsd*|darwin*)
       flags+=(
         '(:)-A[remove automatically installed packages that are no longer required]'
         "-D[don't execute deinstallation scripts]"
@@ -203,7 +207,7 @@ _bsd_pkg() {
     )
 
     case "$OSTYPE" in
-    netbsd*)
+    netbsd*|darwin*)
       flags+=(
         '-B[show build information]'
         '-b[show RCS Id strings]'