7c2d84f49de4d26318828e572f12090628d95e65
- Author
- Robby Russell <robby@planetargon.com>
- Committer
- Robby Russell <robby@planetargon.com>
- Date
Message
Merge pull request #3569 from avalent/master
Add cab autocompletion to the cabal plugin
Diff
1diff --git a/plugins/cabal/cabal.plugin.zsh b/plugins/cabal/cabal.plugin.zsh
2index 9f76add7a30a791add54a4b5af864b4d18172262..cf7d2cf5e0d3b9a66694419ee4144d4e43d2d761 100644
3--- a/plugins/cabal/cabal.plugin.zsh
4+++ b/plugins/cabal/cabal.plugin.zsh
5@@ -45,3 +45,43 @@ function _cabal_commands() {
6 }
7
8 compdef _cabal_commands cabal
9+
10+function _cab_commands() {
11+ local ret=1 state
12+ _arguments ':subcommand:->subcommand' && ret=0
13+
14+ case $state in
15+ subcommand)
16+ subcommands=(
17+ "sync:Fetch the latest package index"
18+ "install:Install packages"
19+ "uninstall:Uninstall packages"
20+ "installed:List installed packages"
21+ "configure:Configure a cabal package"
22+ "build:Build a cabal package"
23+ "clean:Clean up a build directory"
24+ "outdated:Display outdated packages"
25+ "info:Display information of a package"
26+ "sdist:Make tar.gz for source distribution"
27+ "upload:Uploading tar.gz to HackageDB"
28+ "get:Untar a package in the current directory"
29+ "deps:Show dependencies of this package"
30+ "revdeps:Show reverse dependencies of this package"
31+ "check:Check consistency of packages"
32+ "genpaths:Generate Paths_<pkg>.hs"
33+ "search:Search available packages by package name"
34+ "add:Add a source directory"
35+ "test:Run tests"
36+ "bench:Run benchmarks"
37+ "doc:Generate manuals"
38+ "ghci:Run GHCi (with a sandbox)"
39+ "init:Initialize a sandbox"
40+ "help:Display the help message of the command"
41+ )
42+ _describe -t subcommands 'cab subcommands' subcommands && ret=0
43+ esac
44+
45+ return ret
46+}
47+
48+command -v cab >/dev/null 2>&1 && { compdef _cab_commands cab }