about summary refs log tree commit diff
path: root/Completion/Solaris/Command/_ptree
blob: c75a211c473dbb6afcfb9b9c1d872983a9ac164b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#compdef ptree

_ptree() {
	local curcontext="$curcontext" context state line ret=1
	typeset -A opt_args

	_arguments -s \
		'-a[All processes]' \
		'-c[Show contract memberships]' \
		'-z[Show processes in zone]:zone:($(zoneadm list))' \
		'*:pid or user:->pidoruser' && ret=0

	if [[ $ret -ne 0 ]]; then
		_alternative \
			'users:logged-in user:(${$(who -q)\:#(users=*|\#)})' \
			'pids:pid:_pids'
		ret=$?
	fi

	return $ret
}

_ptree "$@"