Debian Codegraph @

src/hpct-trigger.bash-completion

raw
1 # shellcheck shell=bash
2 # ==========================================================================
3 # _ _ _ ____ ____ _____
4 # | | | (_) _ \ ___ _ __ / ___|___ _ _|_ _| __ __ _ ___ ___ _ __
5 # | |_| | | |_) / _ \ '__| | / _ \| '_ \| || '__/ _` |/ __/ _ \ '__|
6 # | _ | | __/ __/ | | |__| (_) | | | | || | | (_| | (_| __/ |
7 # |_| |_|_|_| \___|_| \____\___/|_| |_|_||_| \__,_|\___\___|_|
8 #
9 # --- High-Performance Connectivity Tracer (HiPerConTracer) ---
10 # https://www.nntb.no/~dreibh/hipercontracer/
11 # ==========================================================================
12 #
13 # High-Performance Connectivity Tracer (HiPerConTracer)
14 # Copyright (C) 2015-2026 by Thomas Dreibholz
15 #
16 # This program is free software: you can redistribute it and/or modify
17 # it under the terms of the GNU General Public License as published by
18 # the Free Software Foundation, either version 3 of the License, or
19 # (at your option) any later version.
20 #
21 # This program is distributed in the hope that it will be useful,
22 # but WITHOUT ANY WARRANTY; without even the implied warranty of
23 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 # GNU General Public License for more details.
25 #
26 # You should have received a copy of the GNU General Public License
27 # along with this program. If not, see <http://www.gnu.org/licenses/>.
28 #
29 # Contact: [email protected]
30
31
32 # ###### Bash completion for hpct-trigger ###################################
33 _hpct_trigger()
34 {
35 # Based on: https://www.benningtons.net/index.php/bash-completion/
36 local cur prev words cword
37 if type -t _comp_initialize >/dev/null; then
38 _comp_initialize || return
39 elif type -t _init_completion >/dev/null; then
40 _init_completion || return
41 else
42 # Manual initialization for older bash completion versions:
43 COMPREPLY=()
44 # shellcheck disable=SC2034
45 cur="${COMP_WORDS[COMP_CWORD]}"
46 # shellcheck disable=SC2034
47 prev="${COMP_WORDS[COMP_CWORD-1]}"
48 # shellcheck disable=SC2034,SC2124
49 words="${COMP_WORDS[@]}"
50 # shellcheck disable=SC2034
51 cword="${COMP_CWORD}"
52 fi
53
54 case "${prev}" in
55 # ====== Generic value ===============================================
56 --triggerpingage | \
57 --triggerpingpacketsize | \
58 --triggerpingsbeforequeuing | \
59 -L | --loglevel | \
60 -U | --user | \
61 -# | --measurement-id | \
62 -D | --destination | \
63 --iterations | \
64 --tracerouteinterval | \
65 --tracerouteintervaldeviation | \
66 --tracerouteduration | \
67 --tracerouterounds | \
68 --tracerouteinitialmaxttl | \
69 --traceroutefinalmaxttl | \
70 --tracerouteincrementmaxttl | \
71 --traceroutepacketsize | \
72 --tracerouteudpsourceport | \
73 --tracerouteudpdestinationport | \
74 --pinginterval | \
75 --pingintervaldeviation | \
76 --pingexpiration | \
77 --pingburst | \
78 --pingttl | \
79 --pingpacketsize | \
80 --pingudpsourceport | \
81 --pingudpdestinationport | \
82 -x | --resultstransactionlength | \
83 -F | --resultsformat | \
84 -z | --resultstimestampdepth)
85 return
86 ;;
87 # ====== Special case: compression ====================================
88 -C | --resultscompression)
89 mapfile -t COMPREPLY < <(compgen -W "none XZ BZip2 GZip ZLIB ZSTD" -- "${cur}")
90 return
91 ;;
92 # ====== Special case: IO Module ======================================
93 -M | --iomodule)
94 mapfile -t COMPREPLY < <(compgen -W "ICMP UDP" -- "${cur}")
95 return
96 ;;
97 # ====== Special case: log file =======================================
98 -O | --logfile)
99 # Files with extension .log:
100 _filedir '@(log)'
101 return
102 ;;
103 # ====== Special case: source address =================================
104 -S | --source)
105 # Obtain addresses with default route by using "get-default-ips":
106 mapfile -t COMPREPLY < <(compgen -W "$(get-default-ips)" -- "${cur}" )
107 return
108 ;;
109 # ====== Special case: on/off =========================================
110 -Z | --logcolor)
111 mapfile -t COMPREPLY < <(compgen -W "on off" -- "${cur}")
112 return
113 ;;
114 # ====== Special case: file ===========================================
115 --sources-from-file | \
116 --destinations-from-file)
117 # Arbitrary file names:
118 _filedir
119 return
120 ;;
121 # ====== Special case: directory ======================================
122 -R | --resultsdirectory)
123 # Arbitrary directories:
124 _filedir -d
125 return
126 ;;
127 esac
128
129 # ====== All options =====================================================
130 local opts="
131 --triggerpingage
132 --triggerpingpacketsize
133 --triggerpingsbeforequeuing
134 -P
135 --ping
136 -T
137 --traceroute
138 -L
139 --loglevel
140 -Z
141 --logcolor
142 -O
143 --logfile
144 -q
145 --quiet
146 -w
147 --verbose
148 -U
149 --user
150 -#
151 --measurement-id
152 -S
153 --source
154 -D
155 --destination
156 --sources-from-file
157 --destinations-from-file
158 -M
159 --iomodule
160 -I
161 --iterations
162 --tracerouteinterval
163 --tracerouteintervaldeviation
164 --tracerouteduration
165 --tracerouterounds
166 --tracerouteinitialmaxttl
167 --traceroutefinalmaxttl
168 --tracerouteincrementmaxttl
169 --traceroutepacketsize
170 --tracerouteudpsourceport
171 --tracerouteudpdestinationport
172 --pinginterval
173 --pingintervaldeviation
174 --pingexpiration
175 --pingburst
176 --pingttl
177 --pingpacketsize
178 --pingudpsourceport
179 --pingudpdestinationport
180 -R
181 --resultsdirectory
182 -x
183 --resultstransactionlength
184 -C
185 --resultscompression
186 -F
187 --resultsformat
188 -z
189 --resultstimestampdepth
190 --check
191 -h
192 --help
193 -v
194 --version
195 "
196 mapfile -t COMPREPLY < <(compgen -W "${opts}" -- "${cur}" )
197 return 0
198 }
199
200 complete -F _hpct_trigger hpct-trigger