cabal.plugin.zsh 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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:Make this package ready for installation"
  19. "check:Check the package for common mistakes"
  20. "clean:Clean up after a build"
  21. "copy:Copy teh files into the install locations"
  22. "configure:Prepare to build the package"
  23. "fetch:Downloads packages for later installation"
  24. "haddock:Generate HAddock HTML documentation"
  25. "help:Help about commands"
  26. "hscolour:Generate HsColour colourised code, in HTML format"
  27. "info:Display detailed information about a particular package"
  28. "init:Interactively create a .cabal file"
  29. "install:Installs a list of packages"
  30. "list:List packages matching a search string"
  31. "register:Register this package with the compiler"
  32. "report:Upload build reports to a remote server"
  33. "sdist:Generate a source distribution file (.tar.gz)"
  34. "test:Run the test suite, if any (configure with UserHooks)"
  35. "unpack:Unpacks packages for user inspection"
  36. "update:Updates list of known packages"
  37. "upload:Uploads source packages to Hackage"
  38. )
  39. _describe -t subcommands 'cabal subcommands' subcommands && ret=0
  40. esac
  41. return ret
  42. }
  43. compdef _cabal_commands cabal