ui: Print empty rows when clearing table
[netsniff-ng-new.git] / netsniff-ng.zsh
blobf6588111e2c76cd15bf8292c81cf9c0658650e38
1 #compdef netsniff-ng
3 # netsniff-ng.zsh -- zsh completion function for netsniff-ng
5 # Copyright (C) 2013 Hideo Hattori <hhatto.jp@gmail.com>
7 # This program is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License version 2 as
9 # published by the Free Software Foundation.
11 typeset -A opt_args
12 local context state line
14 _cpu () {
15 _cpus=(${${(f)"$(grep processor /proc/cpuinfo | awk '{print $3}')"}})
16 compadd -a _cpus
19 _user_info () {
20 user_info=(${${(f)"$(awk -F':' '{print $3":"$1}' /etc/passwd)"}})
21 _describe -t usr "user info" user_info && ret=0
24 _group_info () {
25 group_info=(${${(f)"$(awk -F':' '{print $4":"$1}' /etc/passwd)"}})
26 _describe -t usr "group info" group_info && ret=0
29 _interfaces () {
30 _wanted interfaces expl 'network interface' \
31 _net_interfaces
32 _values "Pseudo-device that captures on all interfaces" "any"
35 _arguments -s -S \
36 "(-i -d --dev --in)"{-i,-d,--dev,--in}"[Input source as netdev, pcap or pcap stdin]:input:_interfaces" \
37 "(-o --out)"{-o,--out}"[Output sink as netdev, pcap, directory, trafgen, or stdout]::_gnu_generic" \
38 "(-C --fanout-group)"{-C,--fanout-group}"[Join packet fanout group]" \
39 "(-K --fanout-type)"{-K,--fanout-type}"[Apply fanout discipline: hash|lb|cpu|rnd|roll|qm]" \
40 "(-L --fanout-opts)"{-L,--fanout-opts}"[Additional fanout options: defrag|roll]" \
41 "(-f --filter)"{-f,--filter}"[Use BPF filter file from bpfc or tcpdump-like expression]" \
42 "(-t --type)"{-t,--type}"[Filter type]:filter:(host broadcast multicast others outgoing)" \
43 "(-F --interval)"{-F,--interval}"[Dump interval if -o is a dir: <num>KiB/MiB/GiB/s/sec/min/hrs]:interval:_gnu_generic" \
44 "(-J --jumbo-support)"{-J,--jumbo-support}"[Support for 64KB Super Jumbo Frames (def: 2048B)]" \
45 "(-R --rfraw)"{-R,--rfraw}"[Capture or inject raw 802.11 frames]" \
46 "(-n --num)"{-n,--num}"[Number of packets until exit (def: 0)]" \
47 "(-P --prefix)"{-P,--prefix}"[Prefix for pcaps stored in directory]" \
48 "(-T --magic)"{-T,--magic}"[Pcap magic number/pcap format to store, see -D]" \
49 "(-w --cooked)"{-w,--cooked}"[Use Linux \"cooked\" header instead of link header]" \
50 "(-D --dump-pcap-types)"{-D,--dump-pcap-types}"[Dump pcap types and magic numbers and quit]" \
51 "(-B --dump-bpf)"{-B,--dump-bpf}"[Dump generated BPF assembly]" \
52 "(-r --rand)"{-r,--rand}"[Randomize packet forwarding order (dev->dev)]" \
53 "(-M --no-promisc)"{-M,--no-promisc}"[No promiscuous mode for netdev]" \
54 "(-N --no-hwtimestamp)"{-N,--no-hwtimestamp}"[Disable hardware timestamping]" \
55 "(-A --no-sock-mem)"{-A,--no-sock-mem}"[Don\'t tune core socket memory]" \
56 "(-m --mmap)"{-m,--mmap}"[Mmap(2) pcap file i.e., for replaying pcaps]" \
57 "(-G --sg)"{-G,--sg}"[Scatter/gather pcap file I/O]" \
58 "(-c --clrw)"{-c,--clrw}"[Use slower read(2)/write(2) I/O]" \
59 "(-S --ring-size)"{-S,--ring-size}"[Specify ring size to: <num>KiB/MiB/GiB]:ringsize:" \
60 "(-k --kernel-pull)"{-k,--kernel-pull}"[Kernel pull from user interval in us (def: 10us)]:kernelpull:_gnu_generic" \
61 "(-b --bind-cpu)"{-b,--bind-cpu}"[Bind to specific CPU]:cpunum:_cpu" \
62 "(-u --user)"{-u,--user}"[Drop privileges and change to userid]:user:_user_info" \
63 "(-g --group)"{-g,--group}"[Drop privileges and change to groupid]:group:_group_info" \
64 "(-H --prio-high)"{-H,--prio-high}"[Make this high priority process]" \
65 "(-Q --notouch-irq)"{-Q,--notouch-irq}"[Do not touch IRQ CPU affinity of NIC]" \
66 "(-s --silent)"{-s,--silent}"[Do not print captured packets]" \
67 "(-q --less)"{-q,--less}"[Print less-verbose packet information]" \
68 "(-X --hex)"{-X,--hex}"[Print packet data in hex format]" \
69 "(-l --ascii)"{-l,--ascii}"[Print human-readable packet data]" \
70 "(-U --update)"{-U,--update}"[Update GeoIP databases]" \
71 "(-V --verbose)"{-V,--verbose}"[Be more verbose]" \
72 {-v,--version}"[Show version and exit]:" \
73 {-h,--help}"[Guess what?!]:" \
74 "*::args:_gnu_generic"