2012-11-29 08:51:39 +00:00
|
|
|
#compdef cabal
|
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
# Copyright (c) 2012 Github zsh-users - http://github.com/zsh-users
|
|
|
|
# All rights reserved.
|
|
|
|
#
|
|
|
|
# Redistribution and use in source and binary forms, with or without
|
|
|
|
# modification, are permitted provided that the following conditions are met:
|
|
|
|
# * Redistributions of source code must retain the above copyright
|
|
|
|
# notice, this list of conditions and the following disclaimer.
|
|
|
|
# * Redistributions in binary form must reproduce the above copyright
|
|
|
|
# notice, this list of conditions and the following disclaimer in the
|
|
|
|
# documentation and/or other materials provided with the distribution.
|
|
|
|
# * Neither the name of the zsh-users nor the
|
|
|
|
# names of its contributors may be used to endorse or promote products
|
|
|
|
# derived from this software without specific prior written permission.
|
|
|
|
#
|
|
|
|
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
|
|
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
|
|
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
|
|
# DISCLAIMED. IN NO EVENT SHALL ZSH-USERS BE LIABLE FOR ANY
|
|
|
|
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
|
|
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
|
|
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
|
|
|
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
|
|
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
|
|
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
# Description
|
|
|
|
# -----------
|
|
|
|
#
|
|
|
|
# Completion script for cabal-install (http://hackage.haskell.org/trac/hackage/wiki/CabalInstall)
|
|
|
|
#
|
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
# Authors
|
|
|
|
# -------
|
|
|
|
#
|
|
|
|
# * Gérard Milmeister
|
|
|
|
# * Matvey Aksenov <matvey.aksenov@gmail.com>
|
|
|
|
#
|
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
local WORDS
|
|
|
|
|
|
|
|
_cabal ()
|
|
|
|
{
|
|
|
|
WORDS=()
|
|
|
|
for w in $words[1,(($CURRENT - 1))]; do
|
|
|
|
if [[ $w != -* ]]; then WORDS+=$w; fi
|
|
|
|
done
|
|
|
|
|
|
|
|
if (( $#WORDS == 1 )); then
|
|
|
|
_arguments \
|
2014-04-20 15:53:03 +00:00
|
|
|
{-h,--help}'[show help]' \
|
|
|
|
{-V,--version}'[print version information]' \
|
|
|
|
'--numeric-version[print just the version number]' \
|
|
|
|
'--config-file=[set an alternate location for the config file]:config file:_files' \
|
|
|
|
'--sandbox-config-file=[set an alternate location for the sandbox config file]:config file:_files' \
|
|
|
|
'--require-sandbox[enable requiring the presence of a sandbox for sandbox-aware commands]' \
|
|
|
|
'--no-require-sandbox[disable requiring the presence of a sandbox for sandbox-aware commands]' \
|
|
|
|
'--ignore-sandbox[ignore any existing sandbox]' \
|
2012-11-29 08:51:39 +00:00
|
|
|
'*::command:_cabal_command'
|
|
|
|
else
|
|
|
|
_arguments '*::command:_cabal_command'
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
_cabal_command ()
|
|
|
|
{
|
|
|
|
local -a _cabal_cmds
|
|
|
|
_cabal_cmds=(
|
|
|
|
'install:installs a list of packages'
|
|
|
|
'update:updates list of known packages'
|
|
|
|
'list:list packages matching a search string'
|
|
|
|
'info:display detailed information about a particular package'
|
|
|
|
'fetch:downloads packages for later installation'
|
2014-04-20 15:53:03 +00:00
|
|
|
'freeze:freeze dependencies'
|
2013-09-24 19:16:44 +00:00
|
|
|
"get:get a package's source code"
|
2012-11-29 08:51:39 +00:00
|
|
|
'check:check the package for common mistakes'
|
|
|
|
'sdist:generate a source distribution file (.tar.gz)'
|
|
|
|
'upload:uploads source packages to Hackage'
|
|
|
|
'report:upload build reports to a remote server'
|
2013-09-24 19:16:44 +00:00
|
|
|
'run:runs the compiled executable'
|
2012-11-29 08:51:39 +00:00
|
|
|
'init:interactively create a .cabal file'
|
|
|
|
'configure:prepare to build the package'
|
2014-04-20 15:53:03 +00:00
|
|
|
'build:compile all targets or specific targets'
|
2013-09-24 19:16:44 +00:00
|
|
|
'repl:open an interpreter session for the given target'
|
|
|
|
'sandbox:create/modify/delete a sandbox'
|
2012-11-29 08:51:39 +00:00
|
|
|
'haddock:generate Haddock HTML documentation'
|
2014-04-20 15:53:03 +00:00
|
|
|
'exec:run a command with the cabal environment'
|
|
|
|
'copy:copy the files into the install locations'
|
2012-11-29 08:51:39 +00:00
|
|
|
'clean:clean up after a build'
|
|
|
|
'hscolour:generate HsColour colourised code, in HTML format'
|
|
|
|
'register:register this package with the compiler'
|
|
|
|
'test:run the test suite, if any (configure with UserHooks)'
|
|
|
|
'bench:run the benchmark, if any (configure with UserHooks)'
|
|
|
|
'help:help about commands'
|
|
|
|
)
|
2013-09-24 19:16:44 +00:00
|
|
|
|
|
|
|
local -a _cabal_programs
|
|
|
|
_cabal_programs=()
|
|
|
|
|
|
|
|
programs=(alex ar c2hs cpphs ffihugs gcc ghc ghc-pkg greencard haddock
|
|
|
|
happy hmake hpc hsc2hs hscolour hugs jhc ld lhc lhc-pkg nhc98 pkg-config
|
|
|
|
ranlib strip tar uhc)
|
|
|
|
|
|
|
|
for program in $programs; do
|
|
|
|
_cabal_programs+=(
|
|
|
|
"--with-${program}=[give the path to ${program}]:file:_files"
|
|
|
|
"--${program}-options=[give extra options to ${program}]"
|
|
|
|
"--${program}-option=[give an extra option to ${program}]"
|
|
|
|
)
|
|
|
|
done
|
|
|
|
|
2012-11-29 08:51:39 +00:00
|
|
|
if (( CURRENT == 1 )) then
|
|
|
|
_describe -t commands 'command' _cabal_cmds || compadd "$@"
|
|
|
|
else
|
|
|
|
local curcontext="$curcontext"
|
|
|
|
cmd="${${_cabal_cmds[(r)$WORDS[2]:*]%%:*}}"
|
|
|
|
if (( $#cmd )); then
|
|
|
|
_call_function ret _cabal_$cmd
|
|
|
|
else
|
|
|
|
_message "unknown cabal command: $WORDS[2]"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
_cabal_bench ()
|
|
|
|
{
|
|
|
|
_arguments \
|
|
|
|
{-h,--help}'[show help]' \
|
|
|
|
{-v-,--verbose=}'[control verbosity]:level:(0 1 2 3)' \
|
|
|
|
'--builddir=[the directory where Cabal puts generated build files]:directory:_files -/' \
|
|
|
|
'--benchmark-options=[give extra options to benchmark executables]' \
|
2013-09-24 19:16:44 +00:00
|
|
|
'--benchmark-option=[give an extra option to benchmark executables (no need to quote options containing spaces)]' \
|
|
|
|
{-j,--jobs=}'[run NUM jobs simultaneously]' \
|
2014-04-20 15:53:03 +00:00
|
|
|
$_cabal_programs \
|
2013-09-24 19:16:44 +00:00
|
|
|
"--only[don't reinstall add-source dependencies (sandbox-only)]"
|
2012-11-29 08:51:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
_cabal_build ()
|
|
|
|
{
|
|
|
|
_arguments \
|
|
|
|
{-h,--help}'[show help]' \
|
|
|
|
{-v-,--verbose=}'[control verbosity]:level:(0 1 2 3)' \
|
|
|
|
'--builddir=[the directory where Cabal puts generated build files]:directory:_files -/' \
|
2013-09-24 19:16:44 +00:00
|
|
|
$_cabal_programs \
|
|
|
|
{-j,--jobs=}'[run NUM jobs simultaneously]' \
|
|
|
|
"--only[don't reinstall add-source dependencies (sandbox-only)]"
|
2012-11-29 08:51:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
_cabal_check ()
|
|
|
|
{
|
|
|
|
_arguments {-h,--help}'[show help]'
|
|
|
|
}
|
|
|
|
|
|
|
|
_cabal_clean ()
|
|
|
|
{
|
|
|
|
_arguments \
|
|
|
|
{-h,--help}'[show help]' \
|
|
|
|
{-v-,--verbose=}'[control verbosity]:level:(0 1 2 3)' \
|
|
|
|
'--builddir=[the directory where Cabal puts generated build files]:directory:_files -/' \
|
|
|
|
{-s,--save-configure}'[do not remove the configuration file]'
|
|
|
|
}
|
|
|
|
|
|
|
|
_cabal_configure ()
|
|
|
|
{
|
2014-04-20 15:53:03 +00:00
|
|
|
local context state state_descr line
|
|
|
|
typeset -A opt_args
|
|
|
|
|
2012-11-29 08:51:39 +00:00
|
|
|
_arguments \
|
|
|
|
{-h,--help}'[show help]' \
|
|
|
|
{-v-,--verbose=}'[control verbosity]:level:(0 1 2 3)' \
|
|
|
|
'--builddir=[the directory where Cabal puts generated build files]:directory:_files -/' \
|
|
|
|
{-g,--ghc}'[compile with GHC]' \
|
|
|
|
'--nhc98[compile with NHC]' \
|
|
|
|
'--jhc[compile with JHC]' \
|
|
|
|
'--lhc[compile with LHC]' \
|
|
|
|
'--hugs[compile with Hugs]' \
|
|
|
|
'--uhc[compile with UHC]' \
|
2014-04-20 15:53:03 +00:00
|
|
|
'--haskell-suite[compile with a haskell-suite compiler]' \
|
2012-11-29 08:51:39 +00:00
|
|
|
{-w,--with-compiler=}'[give the path to a particular compiler]:file:_files' \
|
|
|
|
'--with-hc-pkg=[give the path to the package tool]:file:_files' \
|
|
|
|
'--prefix=[take this prefix in preparation of installation]:directory:_files -/' \
|
|
|
|
'--bindir=[installation directory for executables]:directory:_files -/' \
|
|
|
|
'--libdir=[installation directory for libraries]:directory:_files -/' \
|
|
|
|
'--libsubdir=[subdirectory of libdir in which libs are installed]:directory:_files -/' \
|
|
|
|
'--libexecdir=[iinstallation directory for program executables]:directory:_files -/' \
|
|
|
|
'--datadir=[installation directory for read-only data]:directory:_files -/' \
|
|
|
|
'--datasubdir=[subdirectory of datadir in which data files are installed]:directory:_files -/' \
|
|
|
|
'--docdir=[installation directory for documentation]:directory:_files -/' \
|
|
|
|
'--htmldir=[installation directory for HTML]:directory:_files -/' \
|
|
|
|
'--haddockdir=[installation directory for haddock interfaces]:directory:_files -/' \
|
2013-09-24 19:16:44 +00:00
|
|
|
'--sysconfdir=[installation directory for configuration files]:directory:_files -/' \
|
2012-11-29 08:51:39 +00:00
|
|
|
{-b,--scratchdir=}'[directory to receive the built package]:directory:_files -/' \
|
|
|
|
'--program-prefix=[prefix to be applied to installed executables]' \
|
|
|
|
'--program-suffix=[suffix to be applied to installed executables]' \
|
|
|
|
'--enable-library-vanilla[enable Vanilla libraries]' \
|
|
|
|
'--disable-library-vanilla[disable Vanilla libraries]' \
|
|
|
|
{-p,--enable-library-profiling}'[enable Library profiling]' \
|
|
|
|
'--disable-library-profiling[disable Library profiling]' \
|
|
|
|
'--enable-shared[enable Shared library]' \
|
|
|
|
'--disable-shared[disable Shared library]' \
|
|
|
|
'--enable-executable-dynamic[enable Executable dynamic linking]' \
|
|
|
|
'--disable-executable-dynamic[disable Executable dynamic linking]' \
|
|
|
|
'--enable-executable-profiling[enable Executable profiling]' \
|
|
|
|
'--disable-executable-profiling[disable Executable profiling]' \
|
|
|
|
{-O-,--enable-optimization=}'[build with optimization]:level:(0 1 2)' \
|
|
|
|
'--disable-optimization[build without optimization]' \
|
|
|
|
'--enable-library-for-ghci[enable compile library for use with GHCi]' \
|
|
|
|
'--disable-library-for-ghci[disable compile library for use with GHCi]' \
|
|
|
|
'--enable-split-objs[enable split library into smaller objects]' \
|
|
|
|
'--disable-split-objs[disable split library into smaller objects]' \
|
|
|
|
'--enable-executable-stripping[enable strip executables upon installation]' \
|
|
|
|
'--disable-executable-stripping[disable strip executables upon installation]' \
|
|
|
|
'--configure-option=[extra option for configure]' \
|
|
|
|
'--user[enable doing a per-user installation]' \
|
|
|
|
'--global[disable doing a per-user installation]' \
|
2014-04-20 15:53:03 +00:00
|
|
|
'--package-db=[use a given package database]:: :->default-db-or-filepath' \
|
2012-11-29 08:51:39 +00:00
|
|
|
{-f,--flags=}'[force values for the given flags]:flags:' \
|
|
|
|
'--extra-include-dirs=[a list of directories to search for header files]:directory:_files -/' \
|
|
|
|
'--extra-lib-dirs=[a list of directories to search for externallibraries]:directory:_files -/' \
|
2013-09-24 19:16:44 +00:00
|
|
|
'--extra-prog-path=[A list of directories to search for required programs]:directory:_files -/' \
|
2012-11-29 08:51:39 +00:00
|
|
|
'--enable-tests[enable dependency checking and compilation for test suites listed in the package description file]' \
|
|
|
|
'--disable-tests[disable dependency checking and compilation for test suites listed in the package description file]' \
|
|
|
|
'--enable-library-coverage[enable build library and test suites with, Haskell Program Coverage enabled. (GHC only)]' \
|
|
|
|
'--disable-library-coverage[disable build library and test suites with, Haskell Program Coverage enabled. (GHC only)]' \
|
|
|
|
'--enable-benchmarks[enable dependency checking and compilation, for benchmarks listed in the package]' \
|
|
|
|
'--disable-benchmarks[disable dependency checking and compilation, for benchmarks listed in the package]' \
|
2013-09-24 19:16:44 +00:00
|
|
|
$_cabal_programs \
|
2012-11-29 08:51:39 +00:00
|
|
|
'--cabal-lib-version=[select which version of the Cabal lib to use]' \
|
|
|
|
'--constraint=[a list of additional constraints on the dependencies]' \
|
|
|
|
'--preference=[specify preferences on the version of a package]' \
|
2014-04-20 15:53:03 +00:00
|
|
|
'--solver=[select dependency solver to use]:solver:(topdown modular choose)' \
|
|
|
|
'--allow-newer=[ignore upper bounds in dependencies on some or all packages]'
|
|
|
|
|
|
|
|
case $state in
|
|
|
|
(default-db-or-filepath)
|
|
|
|
_alternative \
|
|
|
|
':default db:(global user clear)' \
|
|
|
|
':filepath:_files'
|
|
|
|
;;
|
|
|
|
esac
|
2012-11-29 08:51:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
_cabal_copy ()
|
|
|
|
{
|
|
|
|
_arguments \
|
|
|
|
{-h,--help}'[show help]' \
|
|
|
|
{-v-,--verbose=}'[control verbosity]:level:(0 1 2 3)' \
|
|
|
|
'--builddir=[the directory where Cabal puts generated build]:directory:_files -/' \
|
|
|
|
'--destdir=[directory to copy files to]:directory:_files -/'
|
|
|
|
}
|
|
|
|
|
2014-04-20 15:53:03 +00:00
|
|
|
_cabal_exec ()
|
|
|
|
{
|
|
|
|
_arguments \
|
|
|
|
{-h,--help}'[show help]' \
|
|
|
|
{-v-,--verbose=}'[control verbosity]:level:(0 1 2 3)'
|
|
|
|
}
|
|
|
|
|
2012-11-29 08:51:39 +00:00
|
|
|
_cabal_fetch ()
|
|
|
|
{
|
|
|
|
_arguments \
|
|
|
|
{-h,--help}'[show help]' \
|
|
|
|
{-v-,--verbose=}'[control verbosity]:level:(0 1 2 3)' \
|
|
|
|
'--dependencies[resolve and fetch dependencies]' \
|
|
|
|
'--no-dependencies[ignore dependencies]' \
|
|
|
|
'--dry-run[do not install anything, only print what would be installed]' \
|
|
|
|
'--solver=[select dependency solver to use]:solver:(topdown modular choose)]' \
|
|
|
|
'--max-backjumps=[maximum number of backjumps allowed while solving dependencies]' \
|
|
|
|
'--reorder-goals[try to reorder goals according to certain heuristics]' \
|
|
|
|
'--shadow-installed-packages[if multiple package instances of the same version are installed, treat all but one as shadowed]' \
|
|
|
|
'*:package:_cabal_list_packages'
|
|
|
|
}
|
|
|
|
|
2014-04-20 15:53:03 +00:00
|
|
|
_cabal_freeze ()
|
|
|
|
{
|
|
|
|
_arguments \
|
|
|
|
{-h,--help}'[show help]' \
|
|
|
|
{-v-,--verbose=}'[control verbosity]:level:(0 1 2 3)' \
|
|
|
|
'--dry-run[do not freeze anything, only print what would be frozen]' \
|
|
|
|
'--solver=[select dependency solver to use]:solver:(topdown modular choose)]' \
|
|
|
|
'--max-backjumps=[maximum number of backjumps allowed while solving dependencies]' \
|
|
|
|
'--reorder-goals[try to reorder goals according to certain heuristics]' \
|
|
|
|
'--shadow-installed-packages[if multiple package instances of the same version are installed, treat all but one as shadowed]'
|
|
|
|
}
|
|
|
|
|
2013-09-24 19:16:44 +00:00
|
|
|
_cabal_get ()
|
|
|
|
{
|
|
|
|
_arguments \
|
|
|
|
{-h,--help}'[show help]' \
|
|
|
|
{-v-,--verbose=}'[control verbosity]:level:(0 1 2 3)' \
|
2014-04-20 15:53:03 +00:00
|
|
|
{-d-,--destdir=}'[where to unpack the packages]:directory:_files -/' \
|
2013-09-24 19:16:44 +00:00
|
|
|
{-s,--source-repository=}"[copy the package's source repository]" \
|
|
|
|
'--pristine[unpack the original pristine tarball, rather than updating the .cabal file with the latest revision from the package archive.]' \
|
|
|
|
'*:package:_cabal_list_packages'
|
|
|
|
}
|
|
|
|
|
2012-11-29 08:51:39 +00:00
|
|
|
_cabal_haddock ()
|
|
|
|
{
|
|
|
|
_arguments \
|
|
|
|
{-h,--help}'[show help]' \
|
|
|
|
{-v-,--verbose=}'[control verbosity]:level:(0 1 2 3)' \
|
|
|
|
'--builddir=[the directory where Cabal puts generated files]:directory:_files -/' \
|
2013-09-24 19:16:44 +00:00
|
|
|
'--keep-temp-files[keep temporary files]' \
|
2012-11-29 08:51:39 +00:00
|
|
|
'--hoogle[generate a hoogle database]' \
|
|
|
|
'--html[generate HTML documentation]' \
|
|
|
|
'--html-location=[location of HTML documentation]:url:' \
|
|
|
|
'--executables[run haddock for Executables targets]' \
|
2013-09-24 19:16:44 +00:00
|
|
|
'--tests[run haddock for Test Suite targets]' \
|
|
|
|
'--benchmarks[run haddock for Benchmark targets]' \
|
|
|
|
'--all[run haddock for all targets]' \
|
2012-11-29 08:51:39 +00:00
|
|
|
'--internal[run haddock for internal modules]' \
|
|
|
|
'--css=[path to the haddock stylesheet]:file:_files' \
|
|
|
|
'--hyperlink-source[hyperlink the documentation to the source code]' \
|
|
|
|
'--hscolour-css=[path to the HsColour stylesheet]:file:_files' \
|
|
|
|
'--contents-location=[bake URL in as the location for the contents page]:url:' \
|
|
|
|
'--with-ghc=[path to ghc]:file:_files' \
|
|
|
|
'--with-haddock=[path to haddock]:file:_files' \
|
2013-09-24 19:16:44 +00:00
|
|
|
'--PROG-option=[give an extra option to PROG (no need to quote options containing spaces)]:option:' \
|
2012-11-29 08:51:39 +00:00
|
|
|
'--ghc-options=[give extra options to ghc]:option:' \
|
|
|
|
'--haddock-options=[give extra options to haddock]:option:' \
|
|
|
|
}
|
|
|
|
|
|
|
|
_cabal_help ()
|
|
|
|
{
|
|
|
|
local -a cmds
|
2014-04-20 15:53:03 +00:00
|
|
|
cmds=(install update list info fetch freeze get check sdist upload report run init
|
|
|
|
configure build repl sandbox haddock exec copy clean hscolour register test bench help)
|
2012-11-29 08:51:39 +00:00
|
|
|
_arguments \
|
|
|
|
{-h,--help}'[Show help]' \
|
|
|
|
'*::command:( $cmds )'
|
|
|
|
}
|
|
|
|
|
|
|
|
_cabal_hscolour ()
|
|
|
|
{
|
|
|
|
_arguments \
|
|
|
|
{-h,--help}'[show help]' \
|
|
|
|
{-v-,--verbose=}'[control verbosity]:level:(0 1 2 3)' \
|
|
|
|
'--builddir=[the directory where Cabal puts generated files]:directory:_files -/' \
|
|
|
|
'--executables[run hscolour for Executables targets]' \
|
2013-09-24 19:16:44 +00:00
|
|
|
'--tests[run hscolour for Test Suite targets]' \
|
|
|
|
'--benchmarks[run hscolour for Benchmarks targets]' \
|
|
|
|
'--all[run hscolour for all targets]' \
|
2012-11-29 08:51:39 +00:00
|
|
|
'--css=[path to stylesheet]:file:_files'
|
|
|
|
}
|
|
|
|
|
|
|
|
_cabal_info ()
|
|
|
|
{
|
2014-04-20 15:53:03 +00:00
|
|
|
local context state state_descr line
|
|
|
|
typeset -A opt_args
|
|
|
|
|
2012-11-29 08:51:39 +00:00
|
|
|
_arguments \
|
|
|
|
{-h,--help}'[show help]' \
|
|
|
|
{-v-,--verbose=}'[control verbosity]:level:(0 1 2 3)' \
|
2014-04-20 15:53:03 +00:00
|
|
|
'--package-db=[use a given package database]:: :->default-db-or-filepath' \
|
2012-11-29 08:51:39 +00:00
|
|
|
'*:package:_cabal_list_packages'
|
2014-04-20 15:53:03 +00:00
|
|
|
|
|
|
|
case $state in
|
|
|
|
(default-db-or-filepath)
|
|
|
|
_alternative \
|
|
|
|
':default db:(global user clear)' \
|
|
|
|
':filepath:_files'
|
|
|
|
;;
|
|
|
|
esac
|
2012-11-29 08:51:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
_cabal_install ()
|
|
|
|
{
|
2013-09-24 19:16:44 +00:00
|
|
|
local context state state_descr line
|
|
|
|
typeset -A opt_args
|
|
|
|
|
2012-11-29 08:51:39 +00:00
|
|
|
_arguments \
|
|
|
|
{-h,--help}'[show help]' \
|
|
|
|
{-v-,--verbose=}'[control verbosity]:level:(0 1 2 3)' \
|
|
|
|
'--builddir=[the directory where Cabal puts generated build files]:directory:_files -/' \
|
|
|
|
{-g,--ghc}'[compile with GHC]' \
|
|
|
|
'--nhc98[compile with NHC]' \
|
|
|
|
'--jhc[compile with JHC]' \
|
|
|
|
'--lhc[compile with LHC]' \
|
|
|
|
'--hugs[compile with Hugs]' \
|
|
|
|
'--uhc[compile with UHC]' \
|
2014-04-20 15:53:03 +00:00
|
|
|
'--haskell-suite[compile with a haskell-suite compiler]' \
|
2012-11-29 08:51:39 +00:00
|
|
|
{-w,--with-compiler=}'[give the path to a particular compiler]:file:_files' \
|
|
|
|
'--with-hc-pkg=[give the path to the package tool]:file:_files' \
|
|
|
|
'--prefix=[take this prefix in preparation of installation]:directory:_files -/' \
|
|
|
|
'--bindir=[installation directory for executables]:directory:_files -/' \
|
|
|
|
'--libdir=[installation directory for libraries]:directory:_files -/' \
|
|
|
|
'--libsubdir=[subdirectory of libdir in which libs are installed]:directory:_files -/' \
|
|
|
|
'--libexecdir=[installation directory for program executables]:directory:_files -/' \
|
|
|
|
'--datadir=[installation directory for read-only data]:directory:_files -/' \
|
|
|
|
'--datasubdir=[subdirectory of datadir in which data files are installed]:directory:_files -/' \
|
|
|
|
'--docdir=[installation directory for documentation]:directory:_files -/' \
|
|
|
|
'--htmldir=[installation directory for HTML]:directory:_files -/' \
|
|
|
|
'--haddockdir=[installation directory for haddock interfaces]:directory:_files -/' \
|
2013-09-24 19:16:44 +00:00
|
|
|
'--sysconfdir=[installation directory for configuration files]:directory:_files -/' \
|
2012-11-29 08:51:39 +00:00
|
|
|
{-b,--scratchdir=}'[directory to receive the built package]:directory:_files -/' \
|
|
|
|
'--program-prefix=[prefix to be applied to installed executables]' \
|
|
|
|
'--program-suffix=[suffix to be applied to installed executables]' \
|
|
|
|
'--enable-library-vanilla[enable Vanilla libraries]' \
|
|
|
|
'--disable-library-vanilla[disable Vanilla libraries]' \
|
|
|
|
{-p,--enable-library-profiling}'[enable Library profiling]' \
|
|
|
|
'--disable-library-profiling[disable Library profiling]' \
|
|
|
|
'--enable-shared[enable Shared library]' \
|
|
|
|
'--disable-shared[disable Shared library]' \
|
2014-04-20 15:53:03 +00:00
|
|
|
'--enable-executable-dynamic[enable Executable dynamic linking]' \
|
|
|
|
'--disable-executable-dynamic[disable Executable dynamic linking]' \
|
2012-11-29 08:51:39 +00:00
|
|
|
'--enable-executable-profiling[enable Executable profiling]' \
|
|
|
|
'--disable-executable-profiling[disable Executable profiling]' \
|
|
|
|
{-O-,--enable-optimization=}'[build with optimization]:level:(0 1 2)' \
|
|
|
|
'--disable-optimization[build without optimization]' \
|
|
|
|
'--enable-library-for-ghci[enable compile library for use with GHCi]' \
|
|
|
|
'--disable-library-for-ghci[disable compile library for use with GHCi]' \
|
|
|
|
'--enable-split-objs[enable split library into smaller objects]' \
|
|
|
|
'--disable-split-objs[disable split library into smaller objects]' \
|
|
|
|
'--enable-executable-stripping[enable strip executables upon installation]' \
|
|
|
|
'--disable-executable-stripping[disable strip executables upon installation]' \
|
|
|
|
'--configure-option=[extra option for configure]' \
|
|
|
|
'--user[enable doing a per-user installation]' \
|
|
|
|
'--global[disable doing a per-user installation]' \
|
2014-04-20 15:53:03 +00:00
|
|
|
'--package-db=[use a given package database]:: :->default-db-or-filepath' \
|
2012-11-29 08:51:39 +00:00
|
|
|
{-f,--flags=}'[force values for the given flags]:flags:' \
|
|
|
|
'--extra-include-dirs=[a list of directories to search for header files]:directory:_files -/' \
|
2013-09-24 19:16:44 +00:00
|
|
|
'--extra-lib-dirs=[a list of directories to search for external libraries]:directory:_files -/' \
|
|
|
|
'--extra-prog-path=[a list of directories to search for required programs]:directory:_files -/' \
|
2012-11-29 08:51:39 +00:00
|
|
|
'--enable-tests[enable dependency checking and compilation for test suites listed in the package description file]' \
|
|
|
|
'--disable-tests[disable dependency checking and compilation for test suites listed in the package description file]' \
|
|
|
|
'--enable-library-coverage[enable build library and test suites with, Haskell Program Coverage enabled. (GHC only)]' \
|
|
|
|
'--disable-library-coverage[disable build library and test suites with, Haskell Program Coverage enabled. (GHC only)]' \
|
|
|
|
'--enable-benchmarks[enable dependency checking and compilation, for benchmarks listed in the package]' \
|
|
|
|
'--disable-benchmarks[disable dependency checking and compilation, for benchmarks listed in the package]' \
|
2013-09-24 19:16:44 +00:00
|
|
|
$_cabal_programs \
|
2012-11-29 08:51:39 +00:00
|
|
|
'--cabal-lib-version=[select which version of the Cabal lib to use]' \
|
|
|
|
'--constraint=[a list of additional constraints on the dependencies]' \
|
|
|
|
'--preference=[specify preferences on the version of a package]' \
|
|
|
|
'--solver=[select dependency solver to use]:solver:(topdown modular choose)' \
|
2014-04-20 15:53:03 +00:00
|
|
|
'--allow-newer=[ignore upper bounds in dependencies on some or all packages]' \
|
2012-11-29 08:51:39 +00:00
|
|
|
'--enable-documentation[enable building of documentation]' \
|
|
|
|
'--disable-documentation[disable building of documentation]' \
|
|
|
|
'--doc-index-file=[a central index of haddock API documentation]:file:_files' \
|
|
|
|
'--dry-run[do not install anything]' \
|
|
|
|
'--max-backjumps=[maximum number of backjumps allowed while solving dependencies]' \
|
|
|
|
'--reorder-goals[try to reorder goals according to certain heuristics]' \
|
|
|
|
'--shadow-installed-packages[if multiple package instances of the same version are installed, treat all but one as shadowed]' \
|
|
|
|
'--reinstall[always install]' \
|
|
|
|
'--avoid-reinstalls[do not select versions that would destructively overwrite installed packages]' \
|
|
|
|
'--force-reinstalls[reinstall packages even if they will most likely break other installed packages]' \
|
|
|
|
'--upgrade-dependencies[pick the latest version for all dependencies, rather than trying to pick an installed version]' \
|
2013-09-24 19:16:44 +00:00
|
|
|
{--only-dependencies,--dependencies-only}'[install only the dependencies necessary to build the given packages]' \
|
2012-11-29 08:51:39 +00:00
|
|
|
'--root-cmd=[command used to gain root privileges]::' \
|
|
|
|
'--symlink-bindir=[add symlinks into this directory]:directory:_files -/' \
|
|
|
|
'--build-summary=[save build summaries to file]:file:_files' \
|
|
|
|
'--build-log=[log all builds to file]:file:_files' \
|
|
|
|
'--remote-build-reporting=[generate build reports to send to a remote]:level:(none anonymous detailed)' \
|
|
|
|
'--one-shot[do not record the packages in the world file]' \
|
2014-04-20 15:53:03 +00:00
|
|
|
'--run-tests[run package test suites during installation]' \
|
2013-09-24 19:16:44 +00:00
|
|
|
{-j,--jobs=}'[run NUM jobs simultaneously]' \
|
2012-11-29 08:51:39 +00:00
|
|
|
'--haddock-hoogle[generate a hoogle database]' \
|
|
|
|
'--haddock-html[generate HTML documentation]' \
|
|
|
|
'--haddock-html-location=[location of HTML documentation]:url:' \
|
|
|
|
'--haddock-executables[run haddock for Executables targets]' \
|
2014-04-20 15:53:03 +00:00
|
|
|
'--haddock-tests[run haddock for Test Suite targets]' \
|
|
|
|
'--haddock-benchmarks[run haddock for Benchmarks targets]' \
|
|
|
|
'--haddock-all[run haddock for all targets]' \
|
2012-11-29 08:51:39 +00:00
|
|
|
'--haddock-internal[run haddock for internal modules]' \
|
|
|
|
'--haddock-css=[path to the haddock stylesheet]:file:_files' \
|
|
|
|
'--haddock-hyperlink-source[hyperlink the documentation to the source code]' \
|
|
|
|
'--haddock-hscolour-css=[path to the HsColour stylesheet]:file:_files' \
|
|
|
|
'--haddock-contents-location=[bake URL in as the location for the contents page]:url:' \
|
2013-09-24 19:16:44 +00:00
|
|
|
'*:: :->package-or-cabal-file'
|
|
|
|
|
|
|
|
case $state in
|
2014-04-20 15:53:03 +00:00
|
|
|
(default-db-or-filepath)
|
|
|
|
_alternative \
|
|
|
|
':default db:(global user clear)' \
|
|
|
|
':filepath:_files'
|
|
|
|
;;
|
2013-09-24 19:16:44 +00:00
|
|
|
(package-or-cabal-file)
|
|
|
|
_alternative \
|
|
|
|
':package:_cabal_list_packages' \
|
|
|
|
':files:_files -g "*.cabal"'
|
|
|
|
;;
|
|
|
|
esac
|
2012-11-29 08:51:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
_cabal_list ()
|
|
|
|
{
|
2014-04-20 15:53:03 +00:00
|
|
|
local context state state_descr line
|
|
|
|
typeset -A opt_args
|
|
|
|
|
2012-11-29 08:51:39 +00:00
|
|
|
_arguments \
|
|
|
|
{-h,--help}'[show help]' \
|
|
|
|
{-v-,--verbose=}'[control verbosity]:level:(0 1 2 3)' \
|
|
|
|
'--installed[only print installed packages]' \
|
|
|
|
'--simple-output[print in a easy-to-parse format]' \
|
2014-04-20 15:53:03 +00:00
|
|
|
'--package-db=[use a given package database]:: :->default-db-or-filepath' \
|
2012-11-29 08:51:39 +00:00
|
|
|
'*:package:_cabal_list_packages'
|
2014-04-20 15:53:03 +00:00
|
|
|
|
|
|
|
case $state in
|
|
|
|
(default-db-or-filepath)
|
|
|
|
_alternative \
|
|
|
|
':default db:(global user clear)' \
|
|
|
|
':filepath:_files'
|
|
|
|
;;
|
|
|
|
esac
|
2012-11-29 08:51:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
_cabal_register ()
|
|
|
|
{
|
|
|
|
_arguments \
|
|
|
|
{-h,--help}'[show help]' \
|
|
|
|
{-v-,--verbose=}'[control verbosity]:level:(0 1 2 3)' \
|
|
|
|
'--builddir=[the directory where Cabal puts generated files]:directory:_files -/' \
|
|
|
|
"--user[register in user's local package database]" \
|
|
|
|
"--global[register in the system-wide package database]" \
|
|
|
|
'--inplace[register in build location]' \
|
|
|
|
'--gen-script[generate a script to register later]' \
|
|
|
|
'--gen-pkg-config=[generate package registration file]'
|
|
|
|
}
|
|
|
|
|
2013-09-24 19:16:44 +00:00
|
|
|
_cabal_repl ()
|
|
|
|
{
|
|
|
|
_arguments \
|
|
|
|
{-h,--help}'[show help]' \
|
|
|
|
{-v-,--verbose=}'[control verbosity]:level:(0 1 2 3)' \
|
|
|
|
'--builddir=[the directory where Cabal puts generated build files]:directory:_files -/' \
|
|
|
|
$_cabal_programs
|
|
|
|
}
|
|
|
|
|
2012-11-29 08:51:39 +00:00
|
|
|
_cabal_report ()
|
|
|
|
{
|
|
|
|
_arguments \
|
|
|
|
{-h,--help}'[show help]' \
|
|
|
|
{-v-,--verbose=}'[control verbosity]:level:(0 1 2 3)' \
|
|
|
|
{-u,--username=}'[hackage username]' \
|
|
|
|
{-p,--password=}'[hackage password]'
|
|
|
|
}
|
|
|
|
|
2013-09-24 19:16:44 +00:00
|
|
|
_cabal_run ()
|
|
|
|
{
|
|
|
|
_arguments \
|
|
|
|
{-h,--help}'[show help]' \
|
|
|
|
{-v-,--verbose=}'[control verbosity]:level:(0 1 2 3)' \
|
|
|
|
'--builddir=[the directory where Cabal puts generated build files]:directory:_files -/' \
|
|
|
|
{-j,--jobs=}'[run NUM jobs simultaneously]' \
|
2014-04-20 15:53:03 +00:00
|
|
|
$_cabal_programs \
|
2013-09-24 19:16:44 +00:00
|
|
|
"--only[don't reinstall add-source dependencies (sandbox-only)]"
|
|
|
|
}
|
|
|
|
|
|
|
|
_cabal_sandbox ()
|
|
|
|
{
|
|
|
|
_arguments \
|
|
|
|
{-h,--help}'[show help]' \
|
|
|
|
{-v-,--verbose=}'[control verbosity]:level:(0 1 2 3)' \
|
|
|
|
'--sandbox=[Sandbox location]:sandbox:_files -/'
|
|
|
|
|
|
|
|
if (( CURRENT == 2 )); then
|
|
|
|
local -a _cabal_sandbox_cmds
|
|
|
|
_cabal_sandbox_cmds=(
|
|
|
|
'init:initialize the sandbox'
|
|
|
|
'delete:delete the sandbox'
|
|
|
|
'add-source:add sources path to sandbox'
|
|
|
|
'hc-pkg:call sandbox related haskell compiler package database'
|
|
|
|
'list-sources:list added sources paths'
|
|
|
|
)
|
|
|
|
_describe -t sandbox-commands 'sandbox-command' _cabal_sandbox_cmds || compadd "$@"
|
|
|
|
else
|
|
|
|
case $WORDS[3] in
|
|
|
|
add-source)
|
|
|
|
_arguments \
|
|
|
|
{-h,--help}'[show help]' \
|
|
|
|
{-v-,--verbose=}'[control verbosity]:level:(0 1 2 3)' \
|
|
|
|
'--snapshot[take a snapshot instead of creating a link]' \
|
|
|
|
'--sandbox=[Sandbox location]:sandbox:_files -/' \
|
|
|
|
'*:sources:_files -/'
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
_message "unknown cabal sandbox command: $WORDS[3]"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2012-11-29 08:51:39 +00:00
|
|
|
_cabal_sdist ()
|
|
|
|
{
|
|
|
|
_arguments \
|
|
|
|
{-h,--help}'[show help]' \
|
|
|
|
{-v,--verbose=}'[control verbosity]:level:(0 1 2 3)' \
|
|
|
|
'--builddir=[the directory where Cabal puts generated files]:directory:_files -/' \
|
2013-09-24 19:16:44 +00:00
|
|
|
"--list-sources=[just write a list of the package's sources to a file]:directory:_files -/" \
|
2012-11-29 08:51:39 +00:00
|
|
|
'--snapshot[produce a snapshot source distribution]' \
|
|
|
|
'--output-directory=[generate a source distribution in the given directory]:directory:_files -/' \
|
|
|
|
'--targz[produce a .tar.gz format archive]' \
|
|
|
|
'--zip[produce a .zip format archive]'
|
|
|
|
}
|
|
|
|
|
|
|
|
_cabal_test ()
|
|
|
|
{
|
|
|
|
_arguments \
|
|
|
|
{-h,--help}'[show help]' \
|
|
|
|
{-v-,--verbose=}'[control verbosity]:level:(0 1 2 3)' \
|
|
|
|
'--builddir=[the directory where Cabal puts generated files]:directory:_files -/' \
|
|
|
|
'--log=[log all test suite results to file]:file:_files' \
|
|
|
|
'--machine-log=[produce a machine-readable log file]:file:_files' \
|
|
|
|
'--show-details=[when to show results of individual test cases?]:filter:(always never failures)' \
|
|
|
|
'--keep-tix-files[keep .tix files for HPC between test runs]' \
|
|
|
|
'--test-options=[give extra options to test executables]' \
|
2013-09-24 19:16:44 +00:00
|
|
|
'--test-option=[give an extra option to test executables]' \
|
|
|
|
{-j,--jobs=}'[run NUM jobs simultaneously]' \
|
2014-04-20 15:53:03 +00:00
|
|
|
$_cabal_programs \
|
2013-09-24 19:16:44 +00:00
|
|
|
"--only[don't reinstall add-source dependencies (sandbox-only)]"
|
2012-11-29 08:51:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
_cabal_update ()
|
|
|
|
{
|
|
|
|
_arguments \
|
|
|
|
{-h,--help}'[show help]' \
|
|
|
|
{-v-,--verbose=}'[control verbosity]:level:(0 1 2 3)'
|
|
|
|
}
|
|
|
|
|
|
|
|
_cabal_upload ()
|
|
|
|
{
|
|
|
|
_arguments \
|
|
|
|
{-h,--help}'[show help]' \
|
|
|
|
{-v-,--verbose=}'[control verbosity]:level:(0 1 2 3)' \
|
|
|
|
{-c,--check}'[do not upload, just do QA checks]' \
|
2014-04-20 15:53:03 +00:00
|
|
|
{-u-,--username=}'[hackage username]' \
|
|
|
|
{-p-,--password=}'[hackage password]' \
|
2012-11-29 08:51:39 +00:00
|
|
|
'*:file:_files -g "*.tar.gz"'
|
|
|
|
}
|
|
|
|
|
|
|
|
_cabal_list_packages () {
|
|
|
|
_cabal_get_available_packages
|
|
|
|
_cabal_get_available_files=(*.cabal)
|
|
|
|
compadd "$@" -a -- _cabal_available_packages _cabal_get_available_files
|
|
|
|
}
|
|
|
|
|
|
|
|
_cabal_get_available_packages ()
|
|
|
|
{
|
|
|
|
if ( [[ ${+_cabal_available_packages} -eq 0 ]] || _cache_invalid CABAL_AVAILABLE_PACKAGES ) &&
|
|
|
|
! _retrieve_cache CABAL_AVAILABLE_PACKAGES;
|
|
|
|
then
|
|
|
|
_cabal_available_packages=( $(cabal list --simple-output | cut -d' ' -f1 | uniq) )
|
|
|
|
_store_cache CABAL_AVAILABLE_PACKAGES _cabal_available_packages
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
_cabal "$@"
|