cabal.plugin.zsh 2.02 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
function cabal_sandbox_info() {
    cabal_files=(*.cabal(N))
    if [ $#cabal_files -gt 0 ]; then
        if [ -f cabal.sandbox.config ]; then
            echo "%{$fg[green]%}sandboxed%{$reset_color%}"
        else
            echo "%{$fg[red]%}not sandboxed%{$reset_color%}"
        fi
    fi
}

Trev's avatar
Trev committed
12
13
14
15
16
17
18
19
function _cabal_commands() {
    local ret=1 state
    _arguments ':subcommand:->subcommand' && ret=0

    case $state in
      subcommand)
        subcommands=(
          "bench:Run the benchmark, if any (configure with UserHooks)"
20
          "build:Compile all targets or specific target."
Trev's avatar
Trev committed
21
22
          "check:Check the package for common mistakes"
          "clean:Clean up after a build"
Zbigniew Siciarz's avatar
Zbigniew Siciarz committed
23
          "copy:Copy the files into the install locations"
Trev's avatar
Trev committed
24
          "configure:Prepare to build the package"
25
          "exec:Run a command with the cabal environment"
Trev's avatar
Trev committed
26
          "fetch:Downloads packages for later installation"
27
          "get:Gets a package's source code"
28
          "haddock:Generate Haddock HTML documentation"
Trev's avatar
Trev committed
29
30
31
32
33
34
35
          "help:Help about commands"
          "hscolour:Generate HsColour colourised code, in HTML format"
          "info:Display detailed information about a particular package"
          "init:Interactively create a .cabal file"
          "install:Installs a list of packages"
          "list:List packages matching a search string"
          "register:Register this package with the compiler"
36
          "repl:Open an interpreter session for the given target"
Trev's avatar
Trev committed
37
          "report:Upload build reports to a remote server"
38
39
          "run:Runs the compiled executable"
          "sandbox:Create/modify/delete a sandbox"
Trev's avatar
Trev committed
40
41
42
43
44
45
46
47
48
49
50
51
52
          "sdist:Generate a source distribution file (.tar.gz)"
          "test:Run the test suite, if any (configure with UserHooks)"
          "unpack:Unpacks packages for user inspection"
          "update:Updates list of known packages"
          "upload:Uploads source packages to Hackage"
        )
        _describe -t subcommands 'cabal subcommands' subcommands && ret=0
    esac

    return ret
}

compdef _cabal_commands cabal