1 | 1 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,89 @@ |
0 |
+#compdef port |
|
1 |
+ |
|
2 |
+local subcmds |
|
3 |
+ |
|
4 |
+# we cache the list of ports |
|
5 |
+# we shall use some cache policy to avoid problems with new ports |
|
6 |
+if (( ! $+portlist )); then |
|
7 |
+ portlist=($(port echo all; echo "all current active inactive installed uninstalled outdated")) |
|
8 |
+fi |
|
9 |
+ |
|
10 |
+subcmds=( |
|
11 |
+'activate' |
|
12 |
+'archive' |
|
13 |
+'build' |
|
14 |
+'cat' |
|
15 |
+'clean' |
|
16 |
+'configure' |
|
17 |
+'contents' |
|
18 |
+'deactivate' |
|
19 |
+'dependents' |
|
20 |
+'deps' |
|
21 |
+'destroot' |
|
22 |
+'dir' |
|
23 |
+'distcheck' |
|
24 |
+'distclean' |
|
25 |
+'dmg' |
|
26 |
+'echo' |
|
27 |
+'edit' |
|
28 |
+'extract' |
|
29 |
+'fetch' |
|
30 |
+'file' |
|
31 |
+'help' |
|
32 |
+'info' |
|
33 |
+'install' |
|
34 |
+'installed' |
|
35 |
+'list' |
|
36 |
+'livecheck' |
|
37 |
+'location' |
|
38 |
+'mpkg' |
|
39 |
+'outdated' |
|
40 |
+'patch' |
|
41 |
+'pkg' |
|
42 |
+'provides' |
|
43 |
+'rpmpackage' |
|
44 |
+'search' |
|
45 |
+'selfupdate' |
|
46 |
+'sync' |
|
47 |
+'test' |
|
48 |
+'unarchive' |
|
49 |
+'uninstall' |
|
50 |
+'upgrade' |
|
51 |
+'variants' |
|
52 |
+'version' |
|
53 |
+) |
|
54 |
+ |
|
55 |
+_arguments -C \ |
|
56 |
+'-v[verbose mode (generate verbose messages)]' \ |
|
57 |
+'-d[debug mode (generate debugging messages)]' \ |
|
58 |
+'-q[quiet mode (suppress messages)]' \ |
|
59 |
+'-D[specify portdir]' \ |
|
60 |
+'-k[keep mode (do not autoclean after install)]' \ |
|
61 |
+'-n[dont follow dependencies in upgrade (only for upgrading)]' \ |
|
62 |
+'-a[upgrade all installed ports (only for upgrading)]' \ |
|
63 |
+'-u[uninstall non-active ports when upgrading and uninstalling]' \ |
|
64 |
+'-f[force mode (ignore state file)]' \ |
|
65 |
+'-s[source-only mode]' \ |
|
66 |
+'-b[binary-only mode]' \ |
|
67 |
+'-o[honor state files older than Portfile]' \ |
|
68 |
+'*::command:->command' \ |
|
69 |
+&& return 0 |
|
70 |
+ |
|
71 |
+case $state in |
|
72 |
+ command) |
|
73 |
+ if ((CURRENT == 1)); then |
|
74 |
+ state=subcommands |
|
75 |
+ else |
|
76 |
+ state=portname |
|
77 |
+ fi |
|
78 |
+ ;; |
|
79 |
+esac |
|
80 |
+ |
|
81 |
+case $state in |
|
82 |
+ subcommands) |
|
83 |
+ _describe -t commands 'port commands' subcmds |
|
84 |
+ ;; |
|
85 |
+ portname) |
|
86 |
+ _describe -t commands 'available ports' portlist |
|
87 |
+ ;; |
|
88 |
+esac |
... | ... |
@@ -5,3 +5,8 @@ alias psu="sudo port selfupdate" |
5 | 5 |
alias puni="sudo port uninstall inactive" |
6 | 6 |
alias puo="sudo port upgrade outdated" |
7 | 7 |
alias pup="psu && puo" |
8 |
+ |
|
9 |
+# add macports completion function to path |
|
10 |
+fpath=($ZSH/plugins/macports $fpath) |
|
11 |
+autoload -U compinit |
|
12 |
+compinit -i |