1# Copyright 2019, The Android Open Source Project
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7#     http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
15# Main function.
16function _asuite_main() {
17    local T="$(gettop)/tools"
18    src_atest="$T/asuite/atest/atest_completion.sh"
19    src_acloud="$T/acloud/acloud_completion.sh"
20    src_aidegen="$T/asuite/aidegen/aidegen_completion.sh"
21    declare -a asuite_srcs=($src_atest $src_acloud $src_aidegen)
22    for src in ${asuite_srcs[@]}; do
23        # should_add_completion selectively allows disabling tab completion.
24        # ENVSETUP_NO_COMPLETION=acloud # -> disable acloud completion.
25        # ENVSETUP_NO_COMPLETION=acloud:atest # -> disable acloud and atest.
26        if [[ -f $src ]] && should_add_completion $src ; then
27            source $src || true
28        fi
29    done
30}
31
32_asuite_main
33