summary refs log tree commit diff stats
path: root/tools/nim.bash-completion
blob: 8e569079ac485a473a4a11f53cb7f846c0f923b4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# bash completion for nim                             -*- shell-script -*-

_nim()
{
 local cur prev words cword split
 _init_completion -s || return

 COMPREPLY=()
 cur=${COMP_WORDS[COMP_CWORD]}

 if [ $COMP_CWORD -eq 1 ] ; then
   # first item - suggest commands
   kw="compile c doc compileToC cc compileToCpp cpp compileToOC objc js e rst2html rst2tex jsondoc buildIndex genDepend dump check"
   COMPREPLY=( $( compgen -W "${kw}" -- $cur ) )
   return 0
 fi
  case $prev in
    --stackTrace|--lineTrace|--threads|-x|--checks|--objChecks|--fieldChecks|--rangeChecks|--boundChecks|--overflowChecks|-a|--assertions|--floatChecks|--nanChecks|--infChecks)
      # Options that require on/off
      [[ "$cur" == "=" ]] && cur=""
      COMPREPLY=( $(compgen -W 'on off' -- "$cur") )
      return 0
    ;;
    --opt)
      [[ "$cur" == "=" ]] && cur=""
      COMPREPLY=( $(compgen -W 'none speed size' -- "$cur") )
      return 0
    ;;
    --app)
      [[ "$cur" == "=" ]] && cur=""
      COMPREPLY=( $(compgen -W 'console gui lib staticlib' -- "$cur") )
      return 0
    ;;
    *)
      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="
      COMPREPLY=( $( compgen -W "${kw}" -- $cur ) )
      _filedir '@(nim)'
      #$split
      return 0
    ;;
  esac
  return 0

} &&
complete -onospace -F _nim nim

# ex: ts=2 sw=2 et filetypesh