github.com/mattn/gom@v0.0.0-20190726063113-0ebf2b5d812d/misc/zsh/_gom (about) 1 #compdef gom 2 3 _gom() { 4 local context curcontext="$curcontext" state line cmds ret=1 5 6 typeset -a build_flags 7 build_flags=( 8 '-a[force reinstallation of packages that are already up-to-date]' 9 '-n[print the commands but do not run them]' 10 '-p[number of parallel builds]:number' 11 '-race[enable data race detection]' 12 '-x[print the commands]' 13 '-work[print temporary directory name and keep it]' 14 '-ccflags[flags for 5c/6c/8c]:flags' 15 '-gcflags[flags for 5g/6g/8g]:flags' 16 '-ldflags[flags for 5l/6l/8l]:flags' 17 '-gccgoflags[flags for gccgo]:flags' 18 '-compiler[name of compiler to use]:name' 19 '-installsuffix[suffix to add to package directory]:suffix' 20 '-tags[list of build tags to consider satisfied]:tags' 21 ) 22 23 _arguments \ 24 '1: :->cmds' \ 25 '*:: :->args' \ 26 && ret=0 27 28 case $state in 29 cmds) 30 _values 'gom commands' \ 31 'build[Build with _vendor packages]' \ 32 'install[Install bundled packages into _vendor directory]' \ 33 'test[Run tests with bundles]' \ 34 'run[Run go file with bundles]' \ 35 'doc[Run godoc for bundles]' \ 36 'exec[Execute command with bundle environment]' \ 37 'gen[Generate .travis.yml or Gomfile]' \ 38 && ret=0 39 ;; 40 args) 41 case $line[1] in 42 install) 43 _arguments -s -w : \ 44 ${build_flags[@]} \ 45 '-v[show package names]' \ 46 && ret=0 47 ;; 48 build) 49 _arguments -s -w : \ 50 ${build_flags[@]} \ 51 '-v[show package names]' \ 52 '-o[output file]:file:_files' \ 53 '*:file:_path_files -g "*.go"' \ 54 && ret=0 55 ;; 56 test) 57 _arguments -s -w : \ 58 ${build_flags[@]} \ 59 '-c[do not run, compile the test binary]' \ 60 '-i[do not run, install dependencies]' \ 61 '-v[print test output]' \ 62 '-x[print the commands]' \ 63 '-short[use short mode]' \ 64 '-parallel[number of parallel tests]:number' \ 65 '-cpu[values of GOMAXPROCS to use]:number list' \ 66 '-run[run tests and examples matching regexp]:regexp' \ 67 '-bench[run benchmarks matching regexp]:regexp' \ 68 '-benchmem[print memory allocation stats]' \ 69 '-benchtime[run each benchmark until taking this long]:duration' \ 70 '-blockprofile[write goroutine blocking profile to file]:file' \ 71 '-blockprofilerate[set sampling rate of goroutine blocking profile]:number' \ 72 '-timeout[kill test after that duration]:duration' \ 73 '-cpuprofile[write CPU profile to file]:file:_files' \ 74 '-memprofile[write heap profile to file]:file:_files' \ 75 '-memprofilerate[set heap profiling rate]:number' \ 76 '*:file:_path_files -g "*.go"' \ 77 && ret=0 78 ;; 79 run) 80 _arguments -s -w : \ 81 ${build_flags[@]} \ 82 '*:file:_path_files -g "*.go"' \ 83 && ret=0 84 ;; 85 exec) 86 _normal && ret=0 87 ;; 88 gen) 89 _values 'gen commands' \ 90 'travis-yml[Generate .travis.yml which uses "gom test"]' \ 91 'gomfile[Scan packages and generate Gomfile]' \ 92 && ret=0 93 ;; 94 esac 95 ;; 96 esac 97 98 return ret 99 } 100 101 _gom "$@"