-
Notifications
You must be signed in to change notification settings - Fork 753
Expand file tree
/
Copy pathsysdig
More file actions
134 lines (125 loc) · 5.12 KB
/
sysdig
File metadata and controls
134 lines (125 loc) · 5.12 KB
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
_sysdig_complete()
{
local opts=' \
-A \
--print-ascii \
-b \
--print-base64 \
-C \
--file-size \
-cl \
--list-chisels \
-d \
--displayflt \
-D \
--debug \
-e \
--event-limit \
-E \
--exclude-users \
-F \
--fatfile \
-G \
--seconds \
-H \
--plugin \
-I \
--input \
-i \
--chisel-info \
-h \
--help \
-j \
--json \
-L \
--list-events \
-l \
--list \
--list-markdown \
--libs-version \
--log-level \
--color \
--filter-proclist \
--gvisor-config \
--gvisor-root \
--gvisor-generate-config \
--plugin-config-file \
--plugin-info \
--large-environment \
--unbuffered \
--version \
--page-faults \
-P \
--progress \
-q \
--quiet \
-R \
--resolve-ports \
-S \
--summary \
-v \
--verbose \
-x \
--print-hex \
-X \
--print-hex-ascii \
-z \
--compress \
-n \
--numevents \
-p \
--print \
-r \
--read \
-w \
--write \
-W \
--limit \
-s \
--snaplen \
-t \
--timetype \
-c \
--chisel'
local cur=${COMP_WORDS[COMP_CWORD]}
local prev=${COMP_WORDS[COMP_CWORD-1]}
case "$prev" in
-c|--chisel|-i|--chisel-info)
local chisels=""
local detail="Use the -i flag to get detailed information about a specific chisel"
while IFS= read -r line
do
if [[ $line =~ "---" ]]; then
# skip lines such as
# -----------------
continue;
elif [[ -z "$line" ]]; then
# empty lines reset the category
continue;
elif [[ $line =~ "Category" ]]; then
# category
continue;
elif [[ $line =~ $detail ]]; then
# detail instructions
continue;
fi
local chisel=${line%% *}
if [[ -z "$chisel" ]]; then
# empty lines from description
continue;
fi
chisels="$chisels $chisel"
done < <(sysdig -cl)
COMPREPLY=( $( compgen -W "$chisels" -- $cur ) )
return 0
;;
esac
# completing an option
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W "$opts" -- $cur ) )
fi
}
complete -o default -F _sysdig_complete sysdig
# Local Variables:
# mode:sh
# End: