about summary refs log tree commit diff
path: root/Completion/Solaris/Command/_ptree
blob: 031007ba847a9cef49442a39105b1f71d697ec18 (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:compadd ${$(who -q)\:#(users=*|\#)}' \
			'pids:pid:_pids'
		ret=$?
	fi

	return $ret
}

_ptree "$@"