您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

51 行
1.5 KiB

  1. # bash completion for rebar
  2. _rebar()
  3. {
  4. local cur prev sopts lopts cmdsnvars
  5. COMPREPLY=()
  6. cur="${COMP_WORDS[COMP_CWORD]}"
  7. prev="${COMP_WORDS[COMP_CWORD-1]}"
  8. sopts="-h -v -f -j"
  9. lopts=" --help --verbose --force --jobs="
  10. cmdsnvars="analyze build_plt check_plt clean compile \
  11. create-app create-node eunit generate \
  12. int_test perf_test test \
  13. case= force=1 jobs= suite= verbose=1"
  14. if [[ ${cur} == --* ]] ; then
  15. COMPREPLY=( $(compgen -W "${lopts}" -- ${cur}) )
  16. if [ -n "$COMPREPLY" ] ; then
  17. # append space if matched
  18. COMPREPLY="${COMPREPLY} "
  19. # remove trailing space if --lopt=value option
  20. COMPREPLY=${COMPREPLY/%= /=}
  21. fi
  22. return 0
  23. elif [[ ${cur} == -* ]] ; then
  24. COMPREPLY=( $(compgen -W "${sopts}" -- ${cur}) )
  25. if [ -n "$COMPREPLY" ] ; then
  26. # append space if matched
  27. COMPREPLY="${COMPREPLY} "
  28. fi
  29. return 0
  30. else
  31. COMPREPLY=( $(compgen -W "${cmdsnvars}" -- ${cur}) )
  32. if [ -n "$COMPREPLY" ] ; then
  33. # append space if matched
  34. COMPREPLY="${COMPREPLY} "
  35. # remove trailing space if var= option
  36. COMPREPLY=${COMPREPLY/%= /=}
  37. fi
  38. return 0
  39. fi
  40. }
  41. complete -o nospace -F _rebar rebar
  42. # Local variables:
  43. # mode: shell-script
  44. # sh-basic-offset: 4
  45. # sh-indent-comment: t
  46. # indent-tabs-mode: nil
  47. # End:
  48. # ex: ts=4 sw=4 et filetype=sh