From a8a8bc3967fc7b6906bd03c8f893a206ebc055f5 Mon Sep 17 00:00:00 2001
From: Daniel Stankevich <daniel.stankevich@rea-group.com>
Date: Wed, 16 Sep 2015 17:18:27 +1000
Subject: [PATCH 1/2] Add simple Stack commands list

---
 plugins/stack/stack.plugin.zsh | 49 ++++++++++++++++++++++++++++++++++
 1 file changed, 49 insertions(+)
 create mode 100644 plugins/stack/stack.plugin.zsh

diff --git a/plugins/stack/stack.plugin.zsh b/plugins/stack/stack.plugin.zsh
new file mode 100644
index 000000000..7cc256394
--- /dev/null
+++ b/plugins/stack/stack.plugin.zsh
@@ -0,0 +1,49 @@
+function stack_sandbox_info() {
+    stack_files=(*.stack(N))
+    if [ $#stack_files -gt 0 ]; then
+        if [ -f stack.sandbox.config ]; then
+            echo "%{$fg[green]%}sandboxed%{$reset_color%}"
+        else
+            echo "%{$fg[red]%}not sandboxed%{$reset_color%}"
+        fi
+    fi
+}
+
+function _stack_commands() {
+    local ret=1 state
+    _arguments ':subcommand:->subcommand' && ret=0
+
+    case $state in
+      subcommand)
+        subcommands=(
+          "build:Build the project(s) in this directory/configuration"
+          "install:Build executables and install to a user path"
+          "test:Build and test the project(s) in this directory/configuration"
+          "bench:Build and benchmark the project(s) in this directory/configuration"
+          "haddock:Generate haddocks for the project(s) in this directory/configuration"
+          "new:Create a brand new project"
+          "init:Initialize a stack project based on one or more stack packages"
+          "solver:Use a dependency solver to try and determine missing extra-deps"
+          "setup:Get the appropriate ghc for your project"
+          "path:Print out handy path information"
+          "unpack:Unpack one or more packages locally"
+          "update:Update the package index"
+          "upgrade:Upgrade to the latest stack (experimental)"
+          "upload:Upload a package to Hackage"
+          "dot:Visualize your project's dependency graph using Graphviz dot"
+          "exec:Execute a command"
+          "ghc:Run ghc"
+          "ghci:Run ghci in the context of project(s)"
+          "ide:Run ide-backend-client with the correct arguments"
+          "runghc:Run runghc"
+          "clean:Clean the local packages"
+          "docker:Subcommands specific to Docker use"
+        )
+        _describe -t subcommands 'stack subcommands' subcommands && ret=0
+    esac
+
+    return ret
+}
+
+compdef _stack_commands stack
+

From bb10ad0a13f0dfc1d716ea023d4fc806a4e167d0 Mon Sep 17 00:00:00 2001
From: Daniel Stankevich <daniel.stankevich@rea-group.com>
Date: Wed, 16 Sep 2015 17:25:39 +1000
Subject: [PATCH 2/2] Remove unnecessary sandbox fn

---
 plugins/stack/stack.plugin.zsh | 12 ------------
 1 file changed, 12 deletions(-)

diff --git a/plugins/stack/stack.plugin.zsh b/plugins/stack/stack.plugin.zsh
index 7cc256394..a149208d0 100644
--- a/plugins/stack/stack.plugin.zsh
+++ b/plugins/stack/stack.plugin.zsh
@@ -1,14 +1,3 @@
-function stack_sandbox_info() {
-    stack_files=(*.stack(N))
-    if [ $#stack_files -gt 0 ]; then
-        if [ -f stack.sandbox.config ]; then
-            echo "%{$fg[green]%}sandboxed%{$reset_color%}"
-        else
-            echo "%{$fg[red]%}not sandboxed%{$reset_color%}"
-        fi
-    fi
-}
-
 function _stack_commands() {
     local ret=1 state
     _arguments ':subcommand:->subcommand' && ret=0
@@ -46,4 +35,3 @@ function _stack_commands() {
 }
 
 compdef _stack_commands stack
-