about summary refs log tree commit diff
path: root/Completion/Solaris/Command/_ptree
diff options
context:
space:
mode:
Diffstat (limited to 'Completion/Solaris/Command/_ptree')
-rw-r--r--Completion/Solaris/Command/_ptree23
1 files changed, 23 insertions, 0 deletions
diff --git a/Completion/Solaris/Command/_ptree b/Completion/Solaris/Command/_ptree
new file mode 100644
index 000000000..c75a211c4
--- /dev/null
+++ b/Completion/Solaris/Command/_ptree
@@ -0,0 +1,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 "$@"