_port 1.51 KB
Newer Older
Matt Cable's avatar
Matt Cable committed
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
#compdef port

local subcmds 

# we cache the list of ports
# we shall use some cache policy to avoid problems with new ports
if (( ! $+portlist )); then
	portlist=($(port echo all; echo "all current active inactive installed uninstalled outdated"))
fi

subcmds=(
'activate'
'archive'
'build'
'cat'
'clean'
'configure'
'contents'
'deactivate'
'dependents'
'deps'
'destroot'
'dir'
'distcheck'
'distclean'
'dmg'
'echo'
'edit'
'extract'
'fetch'
'file'
'help'
'info'
'install' 
'installed' 
'list'
'livecheck'
'location'
'mpkg'
'outdated'
'patch'
'pkg'
'provides'
44
45
'rdependents'
'rdeps'
46
'reclaim'
Matt Cable's avatar
Matt Cable committed
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
'rpmpackage'
'search'
'selfupdate'
'sync'
'test'
'unarchive'
'uninstall'
'upgrade' 
'variants'
'version'
)

_arguments -C \
'-v[verbose mode (generate verbose messages)]' \
'-d[debug mode (generate debugging messages)]' \
'-q[quiet mode (suppress messages)]' \
'-D[specify portdir]' \
'-k[keep mode (do not autoclean after install)]' \
'-n[dont follow dependencies in upgrade (only for upgrading)]' \
'-a[upgrade all installed ports (only for upgrading)]' \
'-u[uninstall non-active ports when upgrading and uninstalling]' \
'-f[force mode (ignore state file)]' \
'-s[source-only mode]' \
'-b[binary-only mode]' \
'-o[honor state files older than Portfile]' \
'*::command:->command' \
&& return 0

case $state in
	command)
	if ((CURRENT == 1)); then
		state=subcommands
	else
		state=portname
	fi
	;;
esac

case $state in
	subcommands)
	_describe -t commands 'port commands' subcmds
	;;
	portname)
	_describe -t commands 'available ports' portlist
	;;
esac