nim.bash-completion 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. # bash completion for nim -*- shell-script -*-
  2. _nim()
  3. {
  4. local cur prev words cword split
  5. _init_completion -s || return
  6. COMPREPLY=()
  7. cur=${COMP_WORDS[COMP_CWORD]}
  8. if [ $COMP_CWORD -eq 1 ] ; then
  9. # first item - suggest commands
  10. kw="compile c doc compileToC cc compileToCpp cpp compileToOC objc js e rst2html rst2tex jsondoc buildIndex genDepend dump check"
  11. COMPREPLY=( $( compgen -W "${kw}" -- $cur ) )
  12. return 0
  13. fi
  14. case $prev in
  15. --stackTrace|--lineTrace|--threads|-x|--checks|--objChecks|--fieldChecks|--rangeChecks|--boundChecks|--overflowChecks|-a|--assertions|--floatChecks|--nanChecks|--infChecks)
  16. # Options that require on/off
  17. [[ "$cur" == "=" ]] && cur=""
  18. COMPREPLY=( $(compgen -W 'on off' -- "$cur") )
  19. return 0
  20. ;;
  21. --opt)
  22. [[ "$cur" == "=" ]] && cur=""
  23. COMPREPLY=( $(compgen -W 'none speed size' -- "$cur") )
  24. return 0
  25. ;;
  26. --app)
  27. [[ "$cur" == "=" ]] && cur=""
  28. COMPREPLY=( $(compgen -W 'console gui lib staticlib' -- "$cur") )
  29. return 0
  30. ;;
  31. *)
  32. kw="-r -p= --path= -d= --define= -u= --undef= -f --forceBuild --opt= --app= --stackTrace= --lineTrace= --threads= -x= --checks= --objChecks= --fieldChecks= --rangeChecks= --boundChecks= --overflowChecks= -a= --assertions= --floatChecks= --nanChecks= --infChecks="
  33. COMPREPLY=( $( compgen -W "${kw}" -- $cur ) )
  34. _filedir '@(nim)'
  35. #$split
  36. return 0
  37. ;;
  38. esac
  39. return 0
  40. } &&
  41. complete -onospace -F _nim nim
  42. # ex: ts=2 sw=2 et filetypesh