Debian Codegraph @

src/calcappclient.bash-completion

raw
1 # shellcheck shell=bash
2 # --------------------------------------------------------------------------
3 #
4 # //===// //===== //===// // // //===//
5 # // // // // // // // // //
6 # //===// //===== //===// // // //===<<
7 # // \\ // // // // // //
8 # // \\ =====// // //===== // //===// Version III
9 #
10 # ------------- An Efficient RSerPool Prototype Implementation -------------
11 #
12 # Copyright (C) 2002-2026 by Thomas Dreibholz
13 #
14 # This program is free software: you can redistribute it and/or modify
15 # it under the terms of the GNU General Public License as published by
16 # the Free Software Foundation, either version 3 of the License, or
17 # (at your option) any later version.
18 #
19 # This program is distributed in the hope that it will be useful,
20 # but WITHOUT ANY WARRANTY; without even the implied warranty of
21 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 # GNU General Public License for more details.
23 #
24 # You should have received a copy of the GNU General Public License
25 # along with this program. If not, see <http://www.gnu.org/licenses/>.
26 #
27 # Contact: [email protected]
28
29
30 # ###### Bash completion for calcappclient ####################################
31 _calcappclient()
32 {
33 # Based on: https://www.benningtons.net/index.php/bash-completion/
34 local cur prev words cword
35 if type -t _comp_initialize >/dev/null; then
36 _comp_initialize -n = || return
37 elif type -t _init_completion >/dev/null; then
38 _init_completion -n = || return
39 else
40 # Manual initialization for older bash completion versions:
41 COMPREPLY=()
42 cur="${COMP_WORDS[COMP_CWORD]}"
43 # shellcheck disable=SC2034
44 prev="${COMP_WORDS[COMP_CWORD-1]}"
45 # shellcheck disable=SC2034,SC2124
46 words="${COMP_WORDS[@]}"
47 # shellcheck disable=SC2034
48 cword="${COMP_CWORD}"
49 fi
50
51 # ====== Parameters ======================================================
52 case "${cur}" in
53 # ====== Generic value ===============================================
54 -poolhandle=* | \
55 -jobinterval=* | \
56 -jobsize=* | \
57 -keepalivetransmissioninterval=* | \
58 -keepalivetimeoutinterval=* | \
59 -object=* | \
60 -runtime=* | \
61 -cspinterval=* | \
62 -cspserver=* | \
63 -loglevel=*)
64 cur="${cur#*=}"
65 return
66 ;;
67 # ====== Special case: scalar file ====================================
68 -scalar=*)
69 cur="${cur#*=}"
70 _filedir '@(sca)'
71 return
72 ;;
73 # ====== Special case: vector file ====================================
74 -vector=*)
75 cur="${cur#*=}"
76 _filedir '@(vec)'
77 return
78 ;;
79 # ====== Special case: log file =======================================
80 -logappend=* | \
81 -logfile=*)
82 cur="${cur#*=}"
83 _filedir '@(log)'
84 return
85 ;;
86 # ====== Special case: on/off =========================================
87 -logcolor=*)
88 cur="${cur#*=}"
89 mapfile -t COMPREPLY < <(compgen -W "on off" -- "${cur}")
90 return
91 ;;
92 esac
93
94 # ====== All options =====================================================
95 # Simple options without parameter(s)
96 local opts1="
97 "
98 # Options with "=" and parameter(s)
99 local opts2="
100 -poolhandle
101 -jobinterval
102 -jobsize
103 -keepalivetransmissioninterval
104 -keepalivetimeoutinterval
105 -object
106 -runtime
107 -scalar
108 -vector
109 -cspinterval
110 -cspserver
111 -logappend
112 -logcolor
113 -logfile
114 -loglevel
115 "
116 COMPREPLY=( $( compgen -W "${opts1}" -- "${cur}" )
117 $( compgen -W "${opts2}" -S "=" -- "${cur}" ) )
118 [[ ${COMPREPLY-} == *= ]] && compopt -o nospace
119
120 return 0
121 }
122
123 complete -F _calcappclient calcappclient