File: sysdig

package info (click to toggle)
sysdig 0.40.0%2Brepack-2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,684 kB
  • sloc: cpp: 16,251; sh: 1,080; ansic: 999; makefile: 13
file content (120 lines) | stat: -rw-r--r-- 4,544 bytes parent folder | download | duplicates (3)
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
_sysdig_complete()
{
  local opts='                                  \
  -A                                            \
  --print-ascii                                 \
  -b                                            \
  --print-base64                                \
  -C                                            \
  --file-size                                   \
  -cl                                           \
  --list-chisels                                \
  -d                                            \
  --displayflt                                  \
  -D                                            \
  --debug                                       \
  -e                                            \
  --events                                      \
  -E                                            \
  --exclude-users                               \
  -F                                            \
  --fatfile                                     \
  -G                                            \
  --seconds                                     \
  -h                                            \
  --help                                        \
  -j                                            \
  --json                                        \
  -k                                            \
  --k8s-api                                     \
  -L                                            \
  --list-events                                 \
  -l                                            \
  --list                                        \
  -lv                                           \
  --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                                      \
  -i                                            \
  --chisel-info'

  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: