-
Notifications
You must be signed in to change notification settings - Fork 0
/
snt.bc
107 lines (98 loc) · 2.04 KB
/
snt.bc
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
# bash completion for snt(1)
_snt()
{
local cur prev opts
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
opts="
--version
--verbose
--debug
--quite
--ipv6
--ipv4
--tcp
--udp
--hash=
--compression=
--delta=
--secure
--server
--host=
--port=
--transport=
--listen=
--parallel=
--frequency=
--duration=
--benchmarkmode=
--cipher=
--public-key=
--public-nbits=
--file=
--frequency
--affinity=
--certificate=
--private-key=
--payload=
--dh=
--duplex=
"
#
case "${prev}" in
"--cipher")
local subopt="des 3des blowfish aesecb128 aesecb192 aesecb256 aescbc128 aescbc192 aescbc256 aesfbc128 aesfbc192 aesfbc256 3descbc cast castcbc castcfb rc4 bfcbc bfcfb"
if [[ ${prev} == =* ]] ; then
COMPREPLY=( $(compgen -W "${subopt}" -- ${cur}) )
return 0
fi
COMPREPLY=( $(compgen -W "${subopt}") )
return 0
;;
"--compression=")
local subopt="lz4 gzip"
COMPREPLY=( $(compgen -W "${subopt}" -- ${cur}) )
return 0
;;
"--delta=")
local subopt="int float timestamp hrestime"
COMPREPLY=( $(compgen -W "${subopt}" -- ${cur}) )
return 0
;;
"--duplex=")
local subopt="full half simple"
COMPREPLY=( $(compgen -W "${subopt}" -- ${cur}) )
return 0
;;
"--file=" | "--certificate=" | "--private-key=")
COMPREPLY=( $(compgen -f ${cur}) )
return 0
;;
"--transport=")
local subopt="tcp udp"
COMPREPLY=( $(compgen -W "${subopt}" -- ${cur}) )
return 0
;;
"--hash=")
local subopt="md4 md5 sha sha224 sha256 sha348 sha512"
COMPREPLY=( $(compgen -W "${subopt}" -- ${cur}) )
return 0
;;
"--benchmarkmode")
local subopt="file performance integrity"
COMPREPLY=( $(compgen -W "${subopt}" -- ${cur}) )
return 0
;;
*)
;;
esac
# Default generate compare of all available option.
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
# If there's only one option, without =, then allow a space
if [[ ${#COMPREPLY[@]} == 1 && ${COMPREPLY[0]} != "--"*"=" ]] ; then
compopt +o nospace
fi
return 0
}
complete -o nospace -F _snt snt