-
-
Notifications
You must be signed in to change notification settings - Fork 14
/
_procexp
69 lines (61 loc) · 1.61 KB
/
_procexp
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#compdef procexp
# -----------------------------------------------------------------------------
# Copyright (c) 2017, Jonathan Levin (@Morpheus______ / http://newosxbook.com)
# All rights reserved.
# -----------------------------------------------------------------------------
#
# procexp - Going over the top(1)
# http://newosxbook.com/tools/procexp.html
#
# version: v1-(e^2) , compiled on Dec 11 2016, 14:18:01
#
# -----------------------------------------------------------------------------
#
# Usage: procexp [pid|all] [binary|core|fds|ports|net|tree|threads|regions|all]
# or
# procexp vmmon
#
# This is J's Process Explorer v1-(e^2) , compiled on Dec 11 2016, 14:18:01
#
# -----------------------------------------------------------------------------
function _procexp() {
local curcontext=$curcontext context state line ret=1
typeset -A opt_args
_args() {
local -a commands
commands=(
'all'
'vmmon'
)
_describe -t commands 'command' commands
_alternative 'processes:: _pids' 'jobs:: _jobs -t'
}
local -a _filter_option
_filter_option=(
'core:filtered to core'
'fds:filtered to fds'
'ports:filtered to ports'
'net:filtered to net'
'tree:filtered to tree'
'threads:filtered to threads'
'regions:filtered to regions'
'all:show all dump'
)
_arguments \
'1:arguments:_args' \
'*:: :->args' \
&& ret=1
case $state in
args)
case $words[1] in
*)
_arguments \
"*: :{_describe 'filter option' _filter_option}" \
&& ret=1
;;
esac
;;
esac
return ret
}
_procexp "$*"