a8a8bc3967fc7b6906bd03c8f893a206ebc055f5

Author
Daniel Stankevich <daniel.stankevich@rea-group.com>
Committer
Daniel Stankevich <daniel.stankevich@rea-group.com>
Date

Message

Add simple Stack commands list

Diff

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