cabal.plugin.zsh 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. function cabal_sandbox_info() {
  2. cabal_files=(*.cabal(N))
  3. if [ $#cabal_files -gt 0 ]; then
  4. if [ -f cabal.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 _cabal_commands() {
  12. local ret=1 state
  13. _arguments ':subcommand:->subcommand' && ret=0
  14. case $state in
  15. subcommand)
  16. subcommands=(
  17. "bench:Run the benchmark, if any (configure with UserHooks)"
  18. "build:Compile all targets or specific target."
  19. "check:Check the package for common mistakes"
  20. "clean:Clean up after a build"
  21. "copy:Copy the files into the install locations"
  22. "configure:Prepare to build the package"
  23. "exec:Run a command with the cabal environment"
  24. "fetch:Downloads packages for later installation"
  25. "get:Gets a package's source code"
  26. "haddock:Generate Haddock HTML documentation"
  27. "help:Help about commands"
  28. "hscolour:Generate HsColour colourised code, in HTML format"
  29. "info:Display detailed information about a particular package"
  30. "init:Interactively create a .cabal file"
  31. "install:Installs a list of packages"
  32. "list:List packages matching a search string"
  33. "register:Register this package with the compiler"
  34. "repl:Open an interpreter session for the given target"
  35. "report:Upload build reports to a remote server"
  36. "run:Runs the compiled executable"
  37. "sandbox:Create/modify/delete a sandbox"
  38. "sdist:Generate a source distribution file (.tar.gz)"
  39. "test:Run the test suite, if any (configure with UserHooks)"
  40. "unpack:Unpacks packages for user inspection"
  41. "update:Updates list of known packages"
  42. "upload:Uploads source packages to Hackage"
  43. )
  44. _describe -t subcommands 'cabal subcommands' subcommands && ret=0
  45. esac
  46. return ret
  47. }
  48. compdef _cabal_commands cabal