shell _autotab complete

# bash completion for apollo.sh -*- shell-script -*-
# Usage: ./apollo.sh TAB
autotab_list=("check" "build" "build_dist" "clean_dist" "build_min" "build_prof" "build_no_perception" 
"build_dbg" "build_opt" "build_dbg_gpu" "build_opt_gpu" "build_remote" "build_remote_cache" 
"build_remote_incar" "build_fe" "buildify" "build_py" "config" "doc" "lint" "test" "test_gpu" 
"release" "release_noproprietary" "coverage" "clean" "version" "usage")
function _autotab() {
local cur
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
COMPREPLY=( $(compgen -W "${autotab_list[*]}" -- ${cur}) )
return 0
}
complete -F _autotab apollo.sh
原文地址:https://www.cnblogs.com/cjyp/p/12192042.html