浏览代码

Added cab autocompletion to the cabal plugin.

cab is a wrapper for ghc-pkg and cabal that provides some nice features
like listing outdated packages.
See https://hackage.haskell.org/package/cab for more details on the cab
program.
Ashley Valent 10 年之前
父节点
当前提交
3ba10ad0a2
共有 1 个文件被更改,包括 40 次插入0 次删除
  1. 40 0
      plugins/cabal/cabal.plugin.zsh

+ 40 - 0
plugins/cabal/cabal.plugin.zsh

@@ -45,3 +45,43 @@ function _cabal_commands() {
 }
 
 compdef _cabal_commands cabal
+
+function _cab_commands() {
+    local ret=1 state
+    _arguments ':subcommand:->subcommand' && ret=0
+
+    case $state in
+      subcommand)
+        subcommands=(
+          "sync:Fetch the latest package index"
+          "install:Install packages"
+          "uninstall:Uninstall packages"
+          "installed:List installed packages"
+          "configure:Configure a cabal package"
+          "build:Build a cabal package"
+          "clean:Clean up a build directory"
+          "outdated:Display outdated packages"
+          "info:Display information of a package"
+          "sdist:Make tar.gz for source distribution"
+          "upload:Uploading tar.gz to HackageDB"
+          "get:Untar a package in the current directory"
+          "deps:Show dependencies of this package"
+          "revdeps:Show reverse dependencies of this package"
+          "check:Check consistency of packages"
+          "genpaths:Generate Paths_<pkg>.hs"
+          "search:Search available packages by package name"
+          "add:Add a source directory"
+          "test:Run tests"
+          "bench:Run benchmarks"
+          "doc:Generate manuals"
+          "ghci:Run GHCi (with a sandbox)"
+          "init:Initialize a sandbox"
+          "help:Display the help message of the command"
+        )
+        _describe -t subcommands 'cab subcommands' subcommands && ret=0
+    esac
+
+    return ret
+}
+
+command -v cab >/dev/null 2>&1 && { compdef _cab_commands cab }