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 | --userid | \
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 # shellcheck disable=SC2207
90 COMPREPLY=( $(compgen -W "none XZ BZip2 GZip" -- "${cur}") )
91 return
92 ;;
93 # ====== Special case: IO Module ======================================
94 -M | --iomodule)
95 # shellcheck disable=SC2207
96 COMPREPLY=( $(compgen -W "ICMP UDP" -- "${cur}") )
97 return
98 ;;
99 # ====== Special case: log file =======================================
100 -O | --logfile)
101 # Files with extension .log:
102 _filedir '@(log)'
103 return
104 ;;
105 # ====== Special case: source address =================================
106 -S | --source)
107 # Obtain addresses with default route by using "get-default-ips":
108 # shellcheck disable=SC2207
109 COMPREPLY=( $( compgen -W "$(get-default-ips)" -- "${cur}" ) )
110 return
111 ;;
112 # ====== Special case: on/off =========================================
113 -Z | --logcolor)
114 # shellcheck disable=SC2207
115 COMPREPLY=( $(compgen -W "on off" -- "${cur}") )
116 return
117 ;;
118 # ====== Special case: file ===========================================
119 --sources-from-file | \
120 --destinations-from-file)
121 # Arbitrary file names:
122 _filedir
123 return
124 ;;
125 # ====== Special case: directory ======================================
126 -R | --resultsdirectory)
127 # Arbitrary directories:
128 _filedir -d
129 return
130 ;;
131 esac
132
133 # ====== All options =====================================================
134 local opts="
135 --triggerpingage
136 --triggerpingpacketsize
137 --triggerpingsbeforequeuing
138 -P
139 --ping
140 -T
141 --traceroute
142 -L
143 --loglevel
144 -Z
145 --logcolor
146 -O
147 --logfile
148 -q
149 --quiet
150 -v
151 --verbose
152 -U
153 -#
154 -S
155 --source
156 -D
157 --destination
158 --sources-from-file
159 --destinations-from-file
160 -M
161 --iomodule
162 -I
163 --iterations
164 --tracerouteinterval
165 --tracerouteintervaldeviation
166 --tracerouteduration
167 --tracerouterounds
168 --tracerouteinitialmaxttl
169 --traceroutefinalmaxttl
170 --tracerouteincrementmaxttl
171 --traceroutepacketsize
172 --tracerouteudpsourceport
173 --tracerouteudpdestinationport
174 --pinginterval
175 --pingintervaldeviation
176 --pingexpiration
177 --pingburst
178 --pingttl
179 --pingpacketsize
180 --pingudpsourceport
181 --pingudpdestinationport
182 -R
183 --resultsdirectory
184 -x
185 --resultstransactionlength
186 -C
187 --resultscompression
188 -F
189 --resultsformat
190 -z
191 --resultstimestampdepth
192 --check
193 -h
194 --help
195 --version
196 "
197 # shellcheck disable=SC2207
198 COMPREPLY=( $( compgen -W "${opts}" -- "${cur}" ) )
199 return 0
200 }
201
202 complete -F _hpct_trigger hpct-trigger