View | Details | Raw Unified | Return to bug 33108
Collapse All | Expand All

(-)a/debian/docs/koha-list.xml (+13 lines)
Lines 25-30 Link Here
25
    <cmdsynopsis>
25
    <cmdsynopsis>
26
      <command>koha-list</command>
26
      <command>koha-list</command>
27
      <arg><option>--enabled</option>|<option>--disabled</option></arg>
27
      <arg><option>--enabled</option>|<option>--disabled</option></arg>
28
      <arg><option>--elasticsearch</option>|<option>--noelasticsearch</option></arg>
28
      <arg><option>--email</option>|<option>--noemail</option></arg>
29
      <arg><option>--email</option>|<option>--noemail</option></arg>
29
      <arg><option>--sip</option>|<option>--nosip</option></arg>
30
      <arg><option>--sip</option>|<option>--nosip</option></arg>
30
      <arg><option>--plack</option>|<option>--noplack</option></arg>
31
      <arg><option>--plack</option>|<option>--noplack</option></arg>
Lines 47-52 Link Here
47
        <para>Only show instances that are disabled.</para>
48
        <para>Only show instances that are disabled.</para>
48
      </listitem>
49
      </listitem>
49
    </varlistentry>
50
    </varlistentry>
51
    <varlistentry>
52
      <term><option>--elasticsearch</option></term>
53
        <listitem>
54
          <para>Only show instances that have elasticsearch enabled.</para>
55
        </listitem>
56
      </varlistentry>
57
      <varlistentry>
58
        <term><option>--noelasticsearch</option></term>
59
        <listitem>
60
          <para>Only show instances that do not have elasticsearch enabled.</para>
61
        </listitem>
62
      </varlistentry>
50
    <varlistentry>
63
    <varlistentry>
51
      <term><option>--email</option></term>
64
      <term><option>--email</option></term>
52
      <listitem>
65
      <listitem>
(-)a/debian/koha-common.bash-completion (-1 / +5 lines)
Lines 131-137 _koha_list() Link Here
131
131
132
    COMPREPLY=()
132
    COMPREPLY=()
133
    _get_comp_words_by_ref cur
133
    _get_comp_words_by_ref cur
134
    opts="--enabled --disabled --email --noemail --plack --noplack --sip --nosip --help -h"
134
    opts="--enabled --disabled --email --noemail --plack --noplack --sip --nosip --help -h --elasticsearch --noelasticsearch"
135
135
136
    # Build a list of the already used option switches
136
    # Build a list of the already used option switches
137
    for (( i=0; i < ${#COMP_WORDS[@]}-1; i++ )); do
137
    for (( i=0; i < ${#COMP_WORDS[@]}-1; i++ )); do
Lines 141-146 _koha_list() Link Here
141
                    substract="$substract -e --enabled"; ;;
141
                    substract="$substract -e --enabled"; ;;
142
                --enabled)
142
                --enabled)
143
                    substract="$substract -e --disabled"; ;;
143
                    substract="$substract -e --disabled"; ;;
144
                --elasticsearch)
145
                    substract="$substract -e --noelasticsearch"; ;;
146
                --noelasticsearch)
147
                    substract="$substract -e --elasticsearch"; ;;
144
                --email)
148
                --email)
145
                    substract="$substract -e --noemail"; ;;
149
                    substract="$substract -e --noemail"; ;;
146
                --noemail)
150
                --noemail)
(-)a/debian/koha-core.bash-completion (-1 / +5 lines)
Lines 131-137 _koha_list() Link Here
131
131
132
    COMPREPLY=()
132
    COMPREPLY=()
133
    _get_comp_words_by_ref cur
133
    _get_comp_words_by_ref cur
134
    opts="--enabled --disabled --email --noemail --plack --noplack --sip --nosip --help -h"
134
    opts="--enabled --disabled --email --noemail --plack --noplack --sip --nosip --help -h --elasticsearch --noelasticsearch"
135
135
136
    # Build a list of the already used option switches
136
    # Build a list of the already used option switches
137
    for (( i=0; i < ${#COMP_WORDS[@]}-1; i++ )); do
137
    for (( i=0; i < ${#COMP_WORDS[@]}-1; i++ )); do
Lines 141-146 _koha_list() Link Here
141
                    substract="$substract -e --enabled"; ;;
141
                    substract="$substract -e --enabled"; ;;
142
                --enabled)
142
                --enabled)
143
                    substract="$substract -e --disabled"; ;;
143
                    substract="$substract -e --disabled"; ;;
144
                --elasticsearch)
145
                    substract="$substract -e --noelasticsearch"; ;;
146
                --noelasticsearch)
147
                    substract="$substract -e --elasticsearch"; ;;
144
                --email)
148
                --email)
145
                    substract="$substract -e --noemail"; ;;
149
                    substract="$substract -e --noemail"; ;;
146
                --noemail)
150
                --noemail)
(-)a/debian/scripts/koha-list (-70 / +100 lines)
Lines 29-65 fi Link Here
29
29
30
show_instances()
30
show_instances()
31
{
31
{
32
    local show=$1
33
    local show_email=$2
34
    local show_sip=$3
35
36
    for instance in $( get_instances ); do
32
    for instance in $( get_instances ); do
37
        case $show in
33
        case $show in
38
          "all")
34
          "all")
39
              if instance_filter_email       $instance $show_email && \
35
              if filter_ok $instance; then
40
                 instance_filter_letsencrypt $instance $show_letsencrypt && \
36
                  echo $instance
41
                 instance_filter_plack       $instance $show_plack && \
42
                 instance_filter_z3950       $instance $show_z3950 && \
43
                 instance_filter_sip         $instance $show_sip; then
44
                    echo $instance
45
              fi ;;
37
              fi ;;
46
          "enabled")
38
          "enabled")
47
              if is_enabled $instance; then
39
              if is_enabled $instance; then
48
                  if instance_filter_email       $instance $show_email && \
40
                  if filter_ok $instance; then
49
                     instance_filter_letsencrypt $instance $show_letsencrypt && \
50
                     instance_filter_plack       $instance $show_plack && \
51
                     instance_filter_z3950       $instance $show_z3950 && \
52
                     instance_filter_sip         $instance $show_sip; then
53
                      echo $instance
41
                      echo $instance
54
                  fi
42
                  fi
55
              fi ;;
43
              fi ;;
56
          "disabled")
44
          "disabled")
57
              if ! is_enabled $instance; then
45
              if ! is_enabled $instance; then
58
                  if instance_filter_email       $instance $show_email && \
46
                  if filter_ok $instance; then
59
                     instance_filter_letsencrypt $instance $show_letsencrypt && \
60
                     instance_filter_plack       $instance $show_plack && \
61
                     instance_filter_z3950       $instance $show_z3950 && \
62
                     instance_filter_sip         $instance $show_sip; then
63
                      echo $instance
47
                      echo $instance
64
                  fi
48
                  fi
65
              fi ;;
49
              fi ;;
Lines 67-87 show_instances() Link Here
67
    done
51
    done
68
}
52
}
69
53
54
filter_ok()
55
{
56
    local instance=$1
57
58
    if instance_filter_email         $instance && \
59
       instance_filter_elasticsearch $instance && \
60
       instance_filter_letsencrypt   $instance && \
61
       instance_filter_plack         $instance && \
62
       instance_filter_z3950         $instance && \
63
       instance_filter_sip           $instance; then
64
        return 0;
65
    else
66
        return 1;
67
    fi
68
}
70
69
71
instance_filter_sip()
70
instance_filter_sip()
72
{
71
{
73
    local instancename=$1
72
    local instance=$1
74
    local show_sip=$2;
75
73
76
    case $show_sip in
74
    case $show_sip in
77
        "all")
75
        "all")
78
            return 0 ;;
76
            return 0 ;;
79
        "enabled")
77
        "enabled")
80
            if is_sip_enabled $instancename; then
78
            if is_sip_enabled $instance; then
81
                return 0
79
                return 0
82
            fi ;;
80
            fi ;;
83
        "disabled")
81
        "disabled")
84
            if ! is_sip_enabled $instancename; then
82
            if ! is_sip_enabled $instance; then
85
                return 0
83
                return 0
86
            fi ;;
84
            fi ;;
87
    esac
85
    esac
Lines 92-109 instance_filter_sip() Link Here
92
90
93
instance_filter_plack()
91
instance_filter_plack()
94
{
92
{
95
    local instancename=$1
93
    local instance=$1
96
    local show_plack=$2;
97
94
98
    case $show_plack in
95
    case $show_plack in
99
        "all")
96
        "all")
100
            return 0 ;;
97
            return 0 ;;
101
        "enabled")
98
        "enabled")
102
            if is_plack_enabled $instancename; then
99
            if is_plack_enabled $instance; then
103
                return 0
100
                return 0
104
            fi ;;
101
            fi ;;
105
        "disabled")
102
        "disabled")
106
            if ! is_plack_enabled $instancename; then
103
            if ! is_plack_enabled $instance; then
107
                return 0
104
                return 0
108
            fi ;;
105
            fi ;;
109
    esac
106
    esac
Lines 114-131 instance_filter_plack() Link Here
114
111
115
instance_filter_letsencrypt()
112
instance_filter_letsencrypt()
116
{
113
{
117
    local instancename=$1
114
    local instance=$1
118
    local show_letsencrypt=$2;
119
115
120
    case $show_letsencrypt in
116
    case $show_letsencrypt in
121
        "all")
117
        "all")
122
            return 0 ;;
118
            return 0 ;;
123
        "enabled")
119
        "enabled")
124
            if is_letsencrypt_enabled $instancename; then
120
            if is_letsencrypt_enabled $instance; then
125
                return 0
121
                return 0
126
            fi ;;
122
            fi ;;
127
        "disabled")
123
        "disabled")
128
            if ! is_letsencrypt_enabled $instancename; then
124
            if ! is_letsencrypt_enabled $instance; then
129
                return 0
125
                return 0
130
            fi ;;
126
            fi ;;
131
    esac
127
    esac
Lines 136-153 instance_filter_letsencrypt() Link Here
136
132
137
instance_filter_email()
133
instance_filter_email()
138
{
134
{
139
    local instancename=$1
135
    local instance=$1
140
    local show_email=$2;
141
136
142
    case $show_email in
137
    case $show_email in
143
        "all")
138
        "all")
144
            return 0 ;;
139
            return 0 ;;
145
        "enabled")
140
        "enabled")
146
            if is_email_enabled $instancename; then
141
            if is_email_enabled $instance; then
147
                return 0
142
                return 0
148
            fi ;;
143
            fi ;;
149
        "disabled")
144
        "disabled")
150
            if ! is_email_enabled $instancename; then
145
            if ! is_email_enabled $instance; then
151
                return 0
146
                return 0
152
            fi ;;
147
            fi ;;
153
    esac
148
    esac
Lines 158-175 instance_filter_email() Link Here
158
153
159
instance_filter_z3950()
154
instance_filter_z3950()
160
{
155
{
161
    local instancename=$1
156
    local instance=$1
162
    local show_z3950=$2;
163
157
164
    case $show_z3950 in
158
    case $show_z3950 in
165
        "all")
159
        "all")
166
            return 0 ;;
160
            return 0 ;;
167
        "enabled")
161
        "enabled")
168
            if is_z3950_enabled $instancename; then
162
            if is_z3950_enabled $instance; then
169
                return 0
163
                return 0
170
            fi ;;
164
            fi ;;
171
        "disabled")
165
        "disabled")
172
            if ! is_z3950_enabled $instancename; then
166
            if ! is_z3950_enabled $instance; then
167
                return 0
168
            fi ;;
169
    esac
170
171
    # Didn't match any criteria
172
    return 1
173
}
174
175
instance_filter_elasticsearch()
176
{
177
    local instance=$1
178
179
    case $show_elasticsearch in
180
        "all")
181
            return 0 ;;
182
        "enabled")
183
            if is_elasticsearch_enabled $instance; then
184
                return 0
185
            fi ;;
186
        "disabled")
187
            if ! is_elasticsearch_enabled $instance; then
173
                return 0
188
                return 0
174
            fi ;;
189
            fi ;;
175
    esac
190
    esac
Lines 189-194 set_show() Link Here
189
    fi
204
    fi
190
}
205
}
191
206
207
set_show_elasticsearch()
208
{
209
    local elasticsearch_param=$1
210
211
    if [ "$show_elasticsearch" = "all" ]; then
212
        show_elasticsearch=$elasticsearch_param
213
    else
214
        die "Error: --elasticsearch and --noelasticsearch are mutually exclusive."
215
    fi
216
}
217
192
set_show_email()
218
set_show_email()
193
{
219
{
194
    local email_param=$1
220
    local email_param=$1
Lines 254-272 email turned on. Link Here
254
    
280
    
255
Usage: $scriptname [--enabled|--disabled] [--email|--noemail] [--sip|--nosip] [-h]
281
Usage: $scriptname [--enabled|--disabled] [--email|--noemail] [--sip|--nosip] [-h]
256
Options:
282
Options:
257
    --enabled       Show enabled instances
283
    --enabled        Show enabled instances
258
    --disabled      Show disabled instances
284
    --disabled       Show disabled instances
259
    --email         Show instances with email enabled
285
    --elasticsearch  Show instances with Elasticsearch enabled
260
    --noemail       Show instances with email disabled
286
    --noelasticsarch Show instances with Elasticsearch disabled
261
    --sip           Show instances with SIP enabled
287
    --email          Show instances with email enabled
262
    --nosip         Show instances with SIP disabled
288
    --noemail        Show instances with email disabled
263
    --plack         Show instances with Plack enabled
289
    --sip            Show instances with SIP enabled
264
    --noplack       Show instances with Plack disabled
290
    --nosip          Show instances with SIP disabled
265
    --letsencrypt   Show instances with letsencrypt enabled
291
    --plack          Show instances with Plack enabled
266
    --noletsencrypt Show instances with letsencrypt disabled
292
    --noplack        Show instances with Plack disabled
267
    --z3950         Show instances with Z39.50/SRU enabled
293
    --letsencrypt    Show instances with letsencrypt enabled
268
    --noz3950       Show instances with Z39.50/SRU disabled
294
    --noletsencrypt  Show instances with letsencrypt disabled
269
    --help | -h     Show this help
295
    --z3950          Show instances with Z39.50/SRU enabled
296
    --noz3950        Show instances with Z39.50/SRU disabled
297
    --help | -h      Show this help
270
298
271
The filtering options can be combined, and you probably want to do this
299
The filtering options can be combined, and you probably want to do this
272
(except --email and --noemail, or --enabled and --disabled, that's just silly.)
300
(except --email and --noemail, or --enabled and --disabled, that's just silly.)
Lines 274-309 EOH Link Here
274
}
302
}
275
303
276
show="all"
304
show="all"
305
show_elasticsearch="all"
277
show_email="all"
306
show_email="all"
278
show_sip="all"
307
show_sip="all"
279
show_plack="all"
308
show_plack="all"
280
show_letsencrypt="all"
309
show_letsencrypt="all"
281
show_z3950="all"
310
show_z3950="all"
282
311
283
args=$(getopt -l help,enabled,disabled,email,noemail,sip,nosip,plack,noplack,letsencrypt,noletsencrypt,z3950,noz3950 -o h -n $0 -- "$@")
312
args=$(getopt -l help,enabled,disabled,elasticsearch,noelasticsearch,email,noemail,sip,nosip,plack,noplack,letsencrypt,noletsencrypt,z3950,noz3950 -o h -n $0 -- "$@")
284
set -- $args
313
set -- $args
285
314
286
while [ ! -z "$1" ]
315
while [ ! -z "$1" ]
287
do
316
do
288
    case "$1" in
317
    case "$1" in
289
      -h|--help) usage; exit;;
318
        -h|--help) usage; exit;;
290
        --email) set_show_email "enabled" ;;
319
          --email) set_show_email "enabled" ;;
291
      --noemail) set_show_email "disabled" ;;
320
        --noemail) set_show_email "disabled" ;;
292
          --sip) set_show_sip "enabled" ;;
321
            --sip) set_show_sip "enabled" ;;
293
        --nosip) set_show_sip "disabled" ;;
322
          --nosip) set_show_sip "disabled" ;;
294
        --plack) set_show_plack "enabled" ;;
323
          --plack) set_show_plack "enabled" ;;
295
      --noplack) set_show_plack "disabled" ;;
324
        --noplack) set_show_plack "disabled" ;;
296
  --letsencrypt) set_show_letsencrypt "enabled" ;;
325
    --letsencrypt) set_show_letsencrypt "enabled" ;;
297
--noletsencrypt) set_show_letsencrypt "disabled" ;;
326
  --noletsencrypt) set_show_letsencrypt "disabled" ;;
298
        --z3950) set_show_z3950 "enabled" ;;
327
          --z3950) set_show_z3950 "enabled" ;;
299
      --noz3950) set_show_z3950 "disabled" ;;
328
        --noz3950) set_show_z3950 "disabled" ;;
300
      --enabled) set_show "enabled" ;;
329
  --elasticsearch) set_show_elasticsearch "enabled" ;;
301
     --disabled) set_show "disabled" ;;
330
--noelasticsearch) set_show_elasticsearch "disabled" ;;
302
              *) break;;
331
        --enabled) set_show "enabled" ;;
332
       --disabled) set_show "disabled" ;;
333
                *) break;;
303
    esac
334
    esac
304
    shift
335
    shift
305
done
336
done
306
337
307
show_instances $show $show_email $show_sip
338
show_instances
308
339
309
exit 0
340
exit 0
310
- 

Return to bug 33108