stack.plugin.zsh 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. function stack_sandbox_info() {
  2. stack_files=(*.stack(N))
  3. if [ $#stack_files -gt 0 ]; then
  4. if [ -f stack.sandbox.config ]; then
  5. echo "%{$fg[green]%}sandboxed%{$reset_color%}"
  6. else
  7. echo "%{$fg[red]%}not sandboxed%{$reset_color%}"
  8. fi
  9. fi
  10. }
  11. function _stack_commands() {
  12. local ret=1 state
  13. _arguments ':subcommand:->subcommand' && ret=0
  14. case $state in
  15. subcommand)
  16. subcommands=(
  17. "build:Build the project(s) in this directory/configuration"
  18. "install:Build executables and install to a user path"
  19. "test:Build and test the project(s) in this directory/configuration"
  20. "bench:Build and benchmark the project(s) in this directory/configuration"
  21. "haddock:Generate haddocks for the project(s) in this directory/configuration"
  22. "new:Create a brand new project"
  23. "init:Initialize a stack project based on one or more stack packages"
  24. "solver:Use a dependency solver to try and determine missing extra-deps"
  25. "setup:Get the appropriate ghc for your project"
  26. "path:Print out handy path information"
  27. "unpack:Unpack one or more packages locally"
  28. "update:Update the package index"
  29. "upgrade:Upgrade to the latest stack (experimental)"
  30. "upload:Upload a package to Hackage"
  31. "dot:Visualize your project's dependency graph using Graphviz dot"
  32. "exec:Execute a command"
  33. "ghc:Run ghc"
  34. "ghci:Run ghci in the context of project(s)"
  35. "ide:Run ide-backend-client with the correct arguments"
  36. "runghc:Run runghc"
  37. "clean:Clean the local packages"
  38. "docker:Subcommands specific to Docker use"
  39. )
  40. _describe -t subcommands 'stack subcommands' subcommands && ret=0
  41. esac
  42. return ret
  43. }
  44. compdef _stack_commands stack