about summary refs log tree commit diff
path: root/Completion/Solaris/Command/_ptree
blob: 035614b59c90533994b8d6ff63aeee44133f6002 (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 "$@"