4 ``cabal help`` groups commands into :ref:`global<command-group-global>`,
5 :ref:`database<command-group-database>`, :ref:`init<command-group-init>`,
6 :ref:`configure<command-group-config>`, :ref:`build<command-group-build>`,
7 :ref:`run<command-group-run>` and :ref:`ship<command-group-ship>` sections.
12 Command line interface to the Haskell Cabal infrastructure.
14 See http://www.haskell.org/cabal/ for more information.
16 Usage: cabal [GLOBAL FLAGS] [COMMAND [FLAGS]]
20 user-config Display and update the user's global cabal configuration.
21 help Help about commands.
22 path Display paths used by cabal.
25 update Updates list of known packages.
26 list List packages matching a search string.
27 info Display detailed information about a particular package.
29 [initialization and download]
30 init Create a new cabal package.
31 fetch Downloads packages for later installation.
32 get Download/Extract a package's source code (repository).
34 [project configuration]
35 configure Add extra project configuration.
36 freeze Freeze dependencies.
37 gen-bounds Generate dependency bounds.
38 outdated Check for outdated dependencies.
40 [project building and installing]
41 build Compile targets within the project.
42 install Install packages.
43 haddock Build Haddock documentation.
44 haddock-project Generate Haddocks HTML documentation for the cabal project.
45 clean Clean the package store and remove temporary files.
48 list-bin List the path to a single executable.
49 repl Open an interactive session for the given component.
50 run Run an executable.
53 exec Give a command access to the store.
55 [sanity checks and shipping]
56 check Check the package for common mistakes.
57 sdist Generate a source distribution file (.tar.gz).
58 upload Uploads source packages or documentation to Hackage.
59 report Upload build reports to a remote server.
62 unpack Deprecated alias for 'get'.
63 hscolour Generate HsColour colourised code, in HTML format.
65 [new-style projects (forwards-compatible aliases)]
66 Since cabal-install-3.0.0.0, all 'v2-' prefixed names of commands are just
67 aliases for the simple unprefixed names. So v2-build is an alias for
68 build, v2-install for install and so on.
70 [legacy command aliases]
71 No legacy commands are described.
73 Common Arguments and Flags
74 --------------------------
76 Arguments and flags common to some or all commands are:
79 .. option:: --default-user-config=file
81 Allows a "default" ``cabal.config`` freeze file to be passed in
82 manually. This file will only be used if one does not exist in the
83 project directory already. Typically, this can be set from the
84 global cabal ``config`` file so as to provide a default set of
85 partial constraints to be used by projects, providing a way for
86 users to peg themselves to stable package collections.
89 .. option:: --allow-newer[=DEPS], --allow-older[=DEPS]
91 Selectively relax upper or lower bounds in dependencies without
92 editing the package description respectively.
94 The following description focuses on upper bounds and the
95 :option:`--allow-newer` flag, but applies analogously to
96 :option:`--allow-older` and lower bounds. :option:`--allow-newer`
97 and :option:`--allow-older` can be used at the same time.
99 If you want to install a package A that depends on B >= 1.0 && <
100 2.0, but you have the version 2.0 of B installed, you can compile A
101 against B 2.0 by using ``cabal install --allow-newer=B A``. This
102 works for the whole package index: if A also depends on C that in
103 turn depends on B < 2.0, C's dependency on B will be also relaxed.
111 Resolving dependencies...
112 cabal: Could not resolve dependencies:
114 $ cabal configure --allow-newer
115 Resolving dependencies...
122 # Relax upper bounds in all dependencies.
123 $ cabal install --allow-newer foo
125 # Relax upper bounds only in dependencies on bar, baz and quux.
126 $ cabal install --allow-newer=bar,baz,quux foo
128 # Relax the upper bound on bar and force bar==2.1.
129 $ cabal install --allow-newer=bar --constraint="bar==2.1" foo
131 It's also possible to limit the scope of :option:`--allow-newer` to single
132 packages with the ``--allow-newer=scope:dep`` syntax. This means
133 that the dependency on ``dep`` will be relaxed only for the package
140 # Relax upper bound in foo's dependency on base; also relax upper bound in
141 # every package's dependency on lens.
142 $ cabal install --allow-newer=foo:base,lens
144 # Relax upper bounds in foo's dependency on base and bar's dependency
145 # on time; also relax the upper bound in the dependency on lens specified by
147 $ cabal install --allow-newer=foo:base,lens --allow-newer=bar:time
149 Finally, one can enable :option:`--allow-newer` permanently by setting
150 ``allow-newer: True`` in the :ref:`config file <config-file-discovery>`. Enabling
151 'allow-newer' selectively is also supported in the config file
152 (``allow-newer: foo, bar, baz:base``).
154 .. option:: --preference=CONSTRAINT
156 Specify a soft constraint on versions of a package. The solver will
157 attempt to satisfy these preferences on a "best-effort" basis.
159 .. option:: --enable-build-info
161 Generate accurate build information for build components.
163 Information contains meta information, such as component type, compiler type, and
164 Cabal library version used during the build, but also fine grained information,
165 such as dependencies, what modules are part of the component, etc...
167 On build, a file ``build-info.json`` (in the ``json`` format) will be written to
168 the root of the build directory.
171 The format and fields of the generated build information is currently
172 experimental. In the future we might add or remove fields, depending
173 on the needs of other tooling.
178 "cabal-lib-version": "<cabal lib version>",
180 "flavour": "<compiler name>",
181 "compiler-id": "<compiler id>",
182 "path": "<absolute path of the compiler>"
186 "type": "<component type, e.g. lib | bench | exe | flib | test>",
187 "name": "<component name>",
188 "unit-id": "<unitid>",
190 "<compiler args necessary for compilation>"
193 "<modules in this component>"
196 "<source files relative to hs-src-dirs>"
199 "<source directories of this component>"
201 "src-dir": "<root directory of this component>",
202 "cabal-file": "<cabal file location>"
207 .. jsonschema:: ./json-schemas/build-info.schema.json
209 .. option:: --disable-build-info
211 (default) Do not generate detailed build information for built components.
213 Already generated `build-info.json` files will be removed since they would be stale otherwise.
218 A cabal command target can take any of the following forms:
220 - A package target: ``[pkg:]package``, which specifies that all enabled
221 components of a package to be built. By default, test suites and
222 benchmarks are *not* enabled, unless they are explicitly requested
223 (e.g., via ``--enable-tests``.)
225 - A component target: ``[package:][ctype:]component``, which specifies
226 a specific component (e.g., a library, executable, test suite or
227 benchmark) to be built.
229 - All packages: ``all``, which specifies all packages within the project.
231 - Components of a particular type: ``package:ctypes``, ``all:ctypes``:
232 which specifies all components of the given type. Where valid
235 - ``libs``, ``libraries``,
236 - ``flibs``, ``foreign-libraries``,
237 - ``exes``, ``executables``,
239 - ``benches``, ``benchmarks``.
241 - A module target: ``[package:][ctype:]module``, which specifies that the
242 component of which the given module is a part of will be built.
244 - A filepath target: ``[package:][ctype:]filepath``, which specifies that the
245 component of which the given filepath is a part of will be built.
247 - A script target: ``path/to/script``, which specifies the path to a script
248 file. This is supported by ``build``, ``repl``, ``run``, ``list-bin``, and
249 ``clean``. Script targets are not part of a package.
251 .. _command-group-global:
259 ``cabal user-config [init|diff|update]`` prints and updates user's global
260 cabal preferences. It is very useful when you are e.g. first configuring
261 ``cabal`` on a new machine.
263 - ``cabal user-config init`` creates a new configuration file.
265 .. option:: --config-file=PATH
267 Specify config file path. (default: ``~/.cabal/config``).
269 .. option:: -f, --force
271 Force configuration file overwriting if already exists.
273 - ``cabal user-config diff`` prints a diff of the user's config file and the
276 - ``cabal user-config update`` updates the user's config file with additional
279 .. option:: -a CONFIGLINE or -aCONFIGLINE, --augment=CONFIGLINE
281 Pass additional configuration lines to be incorporated in the
283 ``cabal user-config update --augment="offline: True"``.
285 Note how ``--augment`` syntax follows ``cabal user-config diff``
291 ``cabal path`` allows to query for paths used by ``cabal``.
292 For example, it allows to query for the directories of the cache, store,
293 installed binaries, and so on.
301 compiler-flavour: ghc
302 compiler-id: ghc-9.8.2
303 compiler-path: /home/alice/.ghcup/bin/ghc
304 cache-home: /home/alice/.cabal
305 remote-repo-cache: /home/alice/.cabal/packages
306 logs-dir: /home/alice/.cabal/logs
307 store-dir: /home/alice/.cabal/store
308 config-file: /home/alice/.cabal/config
309 installdir: /home/alice/.cabal/bin
311 Or using the json output:
315 $ cabal path --output-format=json | jq
320 "cabal-version": "3.13.0.0",
324 "path": "/home/alice/.ghcup/bin/ghc"
326 "cache-home": "/home/alice/.cabal",
327 "remote-repo-cache": "/home/alice/.cabal/packages",
328 "logs-dir": "/home/alice/.cabal/logs",
329 "store-dir": "/home/alice/.cabal/store",
330 "config-file": "/home/alice/.cabal/config",
331 "installdir": "/home/alice/.cabal/bin"
334 If ``cabal path`` is passed a single option naming a path, then that
335 path will be printed *without* any label:
339 $ cabal path --installdir
340 /home/alice/.cabal/bin
342 While this interface is intended to be used for scripting, it is an experimental command.
347 $ ls $(cabal path --installdir)
350 .. _command-group-database:
352 Package database commands
353 -------------------------
358 ``cabal update`` updates the state of the package index. If the
359 project contains multiple remote package repositories it will update
360 the index of all of them (e.g. when using overlays).
366 $ cabal update # update all remote repos
367 $ cabal update head.hackage # update only head.hackage
372 ``cabal list [FLAGS] STRINGS`` lists all packages matching a search string.
374 .. option:: --installed
376 Only output installed packages.
378 .. option:: --simple-output
380 Print matching packages in a one-package-one-line format.
382 .. option:: -i, --ignore-case
384 .. option:: -I, --strict-case
386 .. option:: --package-db=DB
388 Append the given package database to the list of used package
389 databases. See `cabal info`_ for a thorough explanation.
391 .. option:: -w PATH or -wPATH, --with-compiler=PATH
393 Path to specific compiler.
398 ``cabal info [FLAGS] PACKAGES`` displays useful informations about remote
401 .. option:: --package-db=DB
403 Append the given package database to the list of package databases
404 used (to satisfy dependencies and register into). May be a specific
405 file, ``global`` or ``user``. The initial list is ``['global'], ['global',
406 'user']``, depending on context. Use ``clear`` to reset the list to empty.
408 .. _command-group-init:
410 Initialization and download
411 ---------------------------
416 ``cabal init [FLAGS]`` initialises a Cabal package, picking
417 reasonable defaults. Run it in your project folder.
419 .. option:: -i, --interactive
421 Enable interactive mode.
423 .. option:: -m, --minimal
425 Generate a short .cabal file, without extra empty fields or
426 explanatory comments.
428 See :ref:`init quickstart` for an overview on the command, and
429 ``cabal init --help`` for the complete list of options.
434 *☞ N.B.:* ``cabal fetch`` only works for legacy ``v1-`` commands and only
435 for single package projects. If you are not maintaining an old project,
436 `cabal build`_ with ``--only-download`` has similar effects to ``fetch``
437 and benefits from compatibility with newer build methods.
439 ``cabal fetch [FLAGS] PACKAGES`` downloads packages for later installation.
440 It fetches the project plus its dependencies, very useful when
441 e.g. you plan to work on a project with unreliable or no internet access.
443 .. option:: --no-dependencies
447 .. option:: --disable-tests
449 Disable dependency checking and compilation
450 for test suites listed in the package
453 .. option:: --disable-benchmarks
455 Disable dependency checking and compilation
456 for benchmarks listed in the package
459 Check ``cabal fetch --help`` for a complete list of options.
466 ``cabal get [FLAGS] [PACKAGES]`` (synonym: ``cabal unpack``) downloads and unpacks
467 the source code of ``PACKAGES`` locally. By default the content of the
468 packages is unpacked in the current working directory, in named subfolders
469 (e.g. ``./filepath-1.2.0.8/``), use ``--destdir=PATH`` to specify another
470 folder. By default the latest version of the package is downloaded, you can
471 ask for a spefic one by adding version numbers
472 (``cabal get random-1.0.0.1``).
474 The ``cabal get`` command supports the following options:
476 .. option:: -s[[head|this|...]], --source-repository[=[head|this|...]]
478 Clone the package's source repository (Darcs, Git, etc.)
479 instead of downloading the tarball. Only works if the
480 package specifies a ``source-repository``.
482 .. option:: --index-state=STATE
484 Pin your request to a specific Hackage index state. Available
485 ``STATE`` formats: Unix timestamps (e.g. ``@1474732068``),
486 ISO8601 UTC timestamps (e.g. ``2016-09-24T17:47:48Z``), or ``HEAD``
488 This determines which package versions are available as well as which
489 ``.cabal`` file revision is selected (unless ``--pristine`` is used).
491 .. option:: --pristine
493 Unpacks the pristine tarball, i.e. disregarding any Hackage revision.
495 .. option:: -d, --destdir=PATH
497 Where to place the package source, defaults to (a subdirectory of)
498 the current directory.
500 .. option:: --only-package-description, --package-description-only
502 Unpack the original pristine tarball, rather than updating the
503 ``.cabal`` file with the latest revision from the package archive.
506 .. _command-group-config:
508 Project configuration
509 ---------------------
514 ``cabal configure`` takes a set of arguments and writes a
515 ``cabal.project.local`` file based on the flags passed to this command.
516 ``cabal configure FLAGS; cabal build`` is roughly equivalent to
517 ``cabal build FLAGS``, except that with ``configure`` the flags
518 are persisted to all subsequent calls to ``build``.
520 ``cabal configure`` is intended to be a convenient way to write out
521 a ``cabal.project.local`` for simple configurations; e.g.,
522 ``cabal configure -w ghc-7.8`` would ensure that all subsequent
523 builds with ``cabal build`` are performed with the compiler
524 ``ghc-7.8``. For more complex configuration, we recommend writing the
525 ``cabal.project.local`` file directly (or placing it in
528 ``cabal configure`` inherits options from ``Cabal``. semantics:
530 - Any flag accepted by ``./Setup configure``.
532 - Any flag accepted by ``cabal configure`` beyond
533 ``./Setup configure``, namely ``--cabal-lib-version``,
534 ``--constraint``, ``--preference`` and ``--solver.``
536 - Any flag accepted by ``cabal install`` beyond ``./Setup configure``.
538 - Any flag accepted by ``./Setup haddock``.
540 The options of all of these flags apply only to *local* packages in a
541 project; this behavior is different than that of ``cabal install``,
542 which applies flags to every package that would be built. The motivation
543 for this is to avoid an innocuous addition to the flags of a package
544 resulting in a rebuild of every package in the store (which might need
545 to happen if a flag actually applied to every transitive dependency). To
546 apply options to an external package, use a ``package`` stanza in a
547 ``cabal.project`` file.
549 There are two ways of modifying the ``cabal.project.local`` file through
550 ``cabal configure``, either by appending new configurations to it, or
551 by simply overwriting it all. Overwriting is the default behaviour, as
552 such, there's a flag ``--enable-append`` to append the new configurations
553 instead. Since overwriting is rather destructive in nature, a backup system
554 is in place, which moves the old configuration to a ``cabal.project.local~``
555 file, this feature can also be disabled by using the ``--disable-backup``
561 If a package is built in several different environments, such as a
562 development environment, a staging environment and a production
563 environment, it may be necessary or desirable to ensure that the same
564 dependency versions are selected in each environment. This can be done
565 with the ``freeze`` command:
567 ``cabal freeze`` writes out a **freeze file** which records all of
568 the versions and flags that are picked by the solver under the
569 current index and flags. Default name of this file is
570 ``cabal.project.freeze`` but in combination with a
571 ``--project-file=my.project`` flag (see :ref:`project-file
572 <cmdoption-project-file>`)
573 the name will be ``my.project.freeze``.
574 A freeze file has the same syntax as ``cabal.project`` and looks
581 constraints: HTTP ==4000.3.3,
582 HTTP +warp-tests -warn-as-error -network23 +network-uri -mtl1 -conduit10,
584 QuickCheck +templatehaskell,
588 For end-user executables, it is recommended that you distribute the
589 ``cabal.project.freeze`` file in your source repository so that all
590 users see a consistent set of dependencies. For libraries, this is not
591 recommended: users often need to build against different versions of
592 libraries than what you developed against.
597 ``cabal gen-bounds [FLAGS]`` generates bounds for all dependencies that do not
598 currently have them. Generated bounds are printed to stdout. You can then
599 paste them into your .cabal file.
600 The generated bounds conform to the `Package Versioning Policy`_, which is
601 a recommended versioning system for publicly released Cabal packages.
603 .. code-block:: console
607 For example, given the following dependencies without bounds specified in
608 :pkg-field:`build-depends`:
617 ``gen-bounds`` might suggest changing them to the following:
622 base >= 4.15.0 && < 4.16,
623 mtl >= 2.2.2 && < 2.3,
624 transformers >= 0.5.6 && < 0.6,
630 ``cabal outdated [FLAGS]`` checks for outdated dependencies in the package
631 description file or freeze file.
633 Manually updating dependency version bounds in a ``.cabal`` file or a
634 freeze file can be tedious, especially when there's a lot of
635 dependencies. The ``cabal outdated`` command is designed to help with
636 that. It will print a list of packages for which there is a new
637 version on Hackage that is outside the version bound specified in the
638 ``build-depends`` field. The ``outdated`` command can also be
639 configured to act on the freeze file and
640 ignore major (or all) version bumps on Hackage for a subset of
645 .. code-block:: console
649 Outdated dependencies:
650 haskell-src-exts <1.17 (latest: 1.19.1)
651 language-javascript <0.6 (latest: 0.6.0.9)
652 unix ==2.7.2.0 (latest: 2.7.2.1)
654 $ cabal outdated --simple-output
659 $ cabal outdated --ignore=haskell-src-exts
660 Outdated dependencies:
661 language-javascript <0.6 (latest: 0.6.0.9)
662 unix ==2.7.2.0 (latest: 2.7.2.1)
664 $ cabal outdated --ignore=haskell-src-exts,language-javascript,unix
665 All dependencies are up to date.
667 $ cabal outdated --ignore=haskell-src-exts,language-javascript,unix -q
671 $ cd /some/other/package
672 $ cabal outdated --freeze-file
673 Outdated dependencies:
674 HTTP ==4000.3.3 (latest: 4000.3.4)
675 HUnit ==1.3.1.1 (latest: 1.5.0.0)
677 $ cabal outdated --freeze-file --ignore=HTTP --minor=HUnit
678 Outdated dependencies:
679 HUnit ==1.3.1.1 (latest: 1.3.1.2)
682 ``cabal outdated`` supports the following flags:
684 .. option:: --freeze-file
686 Read dependency version bounds from the freeze file.
688 (``cabal.config``) instead of the package description file
689 (``$PACKAGENAME.cabal``).
691 .. option:: --v2-freeze-file
695 Read dependency version bounds from the v2-style freeze file
696 (by default, ``cabal.project.freeze``) instead of the package
697 description file. ``--new-freeze-file`` is an alias for this flag
698 that can be used with pre-2.4 ``cabal``.
700 .. option:: --project-file=FILE
704 Read dependency version bounds from the v2-style freeze file
705 related to the named project file (i.e., ``$PROJECTFILE.freeze``)
706 instead of the package description file. If multiple ``--project-file``
707 flags are provided, only the final one is considered. This flag
708 must only be passed in when ``--new-freeze-file`` is present.
710 .. option:: --simple-output
712 Print only the names of outdated dependencies, one per line.
714 .. option:: --exit-code
716 Exit with a non-zero exit code when there are outdated dependencies.
718 .. option:: -q, --quiet
720 Don't print any output. Implies ``-v0`` and ``--exit-code``.
722 .. option:: --ignore=PKGS
724 Don't warn about outdated dependency version bounds for the packages in this list.
726 .. option:: --minor[PKGS]
728 Ignore major version bumps for these packages.
730 E.g. if there's a version 2.0 of a package ``pkg`` on Hackage and the freeze
731 file specifies the constraint ``pkg == 1.9``, ``cabal outdated --freeze
732 --minor=pkg`` will only consider the ``pkg`` outdated when there's a version
733 of ``pkg`` on Hackage satisfying ``pkg > 1.9 && < 2.0``. ``--minor`` can also
734 be used without arguments, in that case major version bumps are ignored for
737 .. _command-group-build:
739 Project building and installing
740 -------------------------------
745 ``cabal build`` takes a set of targets and builds them. It
746 automatically handles building and installing any dependencies of these
749 In component targets, ``package:`` and ``ctype:`` (valid component types
750 are ``lib``, ``flib``, ``exe``, ``test`` and ``bench``) can be used to
751 disambiguate when multiple packages define the same component, or the
752 same component name is used in a package (e.g., a package ``foo``
753 defines both an executable and library named ``foo``). We always prefer
754 interpreting a target as a package name rather than as a component name.
756 Some example targets:
760 $ cabal build lib:foo-pkg # build the library named foo-pkg
761 $ cabal build foo-pkg:foo-tests # build foo-tests in foo-pkg
762 $ cabal build src/Lib.s # build the library component to
763 # which "src/Lib.hs" belongs
764 $ cabal build app/Main.hs # build the executable component of
766 $ cabal build Lib # build the library component to
767 # which the module "Lib" belongs
768 $ cabal build path/to/script # build the script as an executable
770 Beyond a list of targets, ``cabal build`` accepts all the flags that
771 ``cabal configure`` takes. Most of these flags are only taken into
772 consideration when building local packages; however, some flags may
773 cause extra store packages to be built (for example,
774 ``--enable-profiling`` will automatically make sure profiling libraries
775 for all transitive dependencies are built and installed.)
777 When building a script, the executable is cached under the cabal directory.
778 See ``cabal run`` for more information on scripts.
780 In addition ``cabal build`` accepts these flags:
782 .. option:: --only-configure
784 When given we will forego performing a full build and abort after running
785 the configure phase of each target package.
790 ``cabal install [FLAGS] [TARGETS]`` builds the specified target packages and
791 symlinks/copies their executables in ``installdir`` (usually ``~/.local/bin``).
795 If not every package has an executable to install, use ``all:exes`` rather
796 than ``all`` as the target. To overwrite an installation, use
797 ``--overwrite-policy=always`` as the default policy is ``never``.
799 For example this command will build the latest ``cabal-install`` and symlink
800 its ``cabal`` executable:
804 $ cabal install cabal-install
806 In addition, it's possible to use ``cabal install`` to install components
807 of a local project. For example, with an up-to-date Git clone of the Cabal
808 repository, this command will build cabal-install HEAD and symlink the
809 ``cabal`` executable:
813 $ cabal install exe:cabal
815 Where symlinking is not possible (eg. on some Windows versions) the ``copy``
816 method is used by default. You can specify the install method
817 by using ``--install-method`` flag:
821 $ cabal install exe:cabal --install-method=copy --installdir=$HOME/bin
823 Note that copied executables are not self-contained, since they might use
824 data-files from the store.
826 .. _adding-libraries:
828 Adding libraries to GHC package environments
829 """"""""""""""""""""""""""""""""""""""""""""
831 It is also possible to "install" libraries using the ``--lib`` flag. For
832 example, this command will build the latest Cabal library and install it:
836 $ cabal install --lib Cabal
838 This works by managing GHC package environment files. By default, it is writing
839 to the global environment in ``~/.ghc/$ARCH-$OS-$GHCVER/environments/default``.
840 ``install`` provides the ``--package-env`` flag to control which of these
841 environments is modified.
843 This command will modify the environment file in the current directory:
847 $ cabal install --lib Cabal --package-env .
849 This command will modify the environment file in the ``~/foo`` directory:
853 $ cabal install --lib Cabal --package-env foo/
855 Do note that the results of the previous two commands will be overwritten by
856 the use of other style commands, so it is not recommended to use them inside
859 This command will modify the environment in the ``local.env`` file in the
864 $ cabal install --lib Cabal --package-env local.env
866 This command will modify the ``myenv`` named global environment:
870 $ cabal install --lib Cabal --package-env myenv
872 If you wish to create a named environment file in the current directory where
873 the name does not contain an extension, you must reference it as ``./myenv``.
875 You can learn more about how to use these environments in `this section of the
876 GHC manual <https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/packages.html#package-environments>`_.
881 ``cabal haddock [FLAGS] [TARGET]`` builds Haddock documentation for
882 the specified packages within the project.
884 If a target is not a library :cfg-field:`haddock-benchmarks`,
885 :cfg-field:`haddock-executables`, :cfg-field:`haddock-internal`,
886 :cfg-field:`haddock-tests` will be implied as necessary.
888 cabal haddock-project
889 ^^^^^^^^^^^^^^^^^^^^^
891 ``cabal haddock-project [FLAGS]`` builds Haddock documentation for all local
892 packages specified in the project.
894 By default the documentation will be put in ``./haddocks`` folder, this can be
895 modified with the ``--output`` flag.
897 This command supports two primary modes: building a self contained directory
898 (which is the default mode) or documentation that links to Hackage (with
901 In both cases the html index as well as quickjump index will include all terms
902 and types defined in any of the local packages, but not ones that are included
903 in any of the dependencies. But note that if you navigate to a dependency,
904 you will have access to its quickjump index.
906 The generated landing page will contain one tree of all modules per local
912 ``cabal clean [FLAGS]`` cleans up the temporary files and build artifacts
913 stored in the ``dist-newstyle`` folder.
915 By default, it removes the entire folder, but it can also spare the configuration
916 and caches if the ``--save-config`` option is given, in which case it only removes
917 the build artefacts (``.hi``, ``.o`` along with any other temporary files generated
918 by the compiler, along with the build output).
920 ``cabal clean [FLAGS] path/to/script`` cleans up the temporary files and build
921 artifacts for the script, which are stored under the .cabal/script-builds directory.
923 In addition when clean is invoked it will remove all script build artifacts for
924 which the corresponding script no longer exists.
926 .. _command-group-run:
934 ``cabal list-bin`` will either (a) display the path for a single executable or (b)
935 complain that the target doesn't resolve to a single binary. In the latter case,
936 it will name the binary products contained in the package. These products can
937 be used to narrow the search and get an actual path to a particular executable.
939 Example showing a failure to resolve to a single executable.
943 $ cabal list-bin cabal-install
944 cabal: The list-bin command is for finding a single binary at once. The
945 target 'cabal-install' refers to the package cabal-install-#.#.#.# which
946 includes the executable 'cabal', the test suite 'unit-tests', the test suite
947 'mem-use-tests', the test suite 'long-tests' and the test suite
948 'integration-tests2'.
950 For a scope that results in only one item we'll get a path.
954 $ cabal list-bin cabal-install:exes
955 /.../dist-newstyle/build/.../cabal/cabal
957 $ cabal list-bin cabal-install:cabal
958 /.../dist-newstyle/build/.../cabal/cabal
960 We can also scope to test suite targets as they produce binaries.
964 $ cabal list-bin cabal-install:tests
965 cabal: The list-bin command is for finding a single binary at once. The
966 target 'cabal-install:tests' refers to the test suites in the package
967 cabal-install-#.#.#.# which includes the test suite 'unit-tests', the test
968 suite 'mem-use-tests', the test suite 'long-tests' and the test suite
969 'integration-tests2'.
971 $ cabal list-bin cabal-install:unit-tests
972 /.../dist-newstyle/.../unit-tests/unit-tests
974 It can also be used to display the location of the cached executable for a
979 $ cabal list-bin path/to/script
980 $XDG_CACHE_HOME/cabal/script-builds/.../bin/script
982 Note that ``cabal list-bin`` will print the executables' location, but
983 will not make sure that these executables actually exist (i.e., have
984 been successfully built). In order to determine the correct location,
985 it may invoke the configuration step (see ``cabal configure``).
990 ``cabal repl TARGET [FLAGS]``
991 opens an interactive session for the target component within the project and
992 loads all of the modules of the target into GHCi as interpreted bytecode.
993 The available targets are the same as for the ``build`` command: individual components
994 within packages in the project, including libraries, executables, test-suites
995 and benchmarks (see `the build section <#cabal-build>`__ for the target syntax).
996 Local packages can also be specified, in which case the library
997 component in the package will be used, or the (first listed) executable in the
998 package if there is no library. Dependencies are built or rebuilt as necessary.
1004 $ cabal repl # default component in the package in the current directory
1005 $ cabal repl pkgname # default component in the package named 'pkgname'
1006 $ cabal repl ./pkgfoo # default component in the package in the ./pkgfoo directory
1007 $ cabal repl cname # component named 'cname'
1008 $ cabal repl pkgname:cname # component 'cname' in the package 'pkgname'
1010 Configuration flags can be specified on the command line and these extend the project
1011 configuration from the 'cabal.project', 'cabal.project.local' and other files.
1013 .. option:: --repl-options=FLAG
1015 To avoid ``ghci``-specific flags from triggering unneeded global rebuilds, these
1016 flags are stripped from the internal configuration. As a result,
1017 ``--ghc-options`` will no longer (reliably) work to pass flags to ``ghci`` (or
1018 other REPLs). Instead, you should use the ``--repl-options`` flag to
1019 specify these options to the invoked REPL.
1021 .. option:: --repl-no-load
1023 Disables the loading of target modules at startup.
1025 .. option:: -b DEPENDENCIES or -bDEPENDENCIES, --build-depends=DEPENDENCIES
1027 A way to experiment with libraries without needing to download
1028 them manually or to install them globally.
1030 This command opens a REPL with the current default target loaded, and a version
1031 of the ``vector`` package matching that specification exposed.
1035 $ cabal repl --build-depends="vector >= 0.12 && < 0.13"
1037 Both of these commands do the same thing as the above, but only expose ``base``,
1038 ``vector``, and the ``vector`` package's transitive dependencies even if the user
1039 is in a project context.
1043 $ cabal repl --ignore-project --build-depends="vector >= 0.12 && < 0.13"
1044 $ cabal repl --project='' --build-depends="vector >= 0.12 && < 0.13"
1046 This command would add ``vector``, but not (for example) ``primitive``, because
1047 it only includes the packages specified on the command line (and ``base``, which
1048 cannot be excluded for technical reasons).
1052 $ cabal repl --build-depends=vector --no-transitive-deps
1054 ``cabal repl`` can open scripts by passing the path to the script as the target.
1058 $ cabal repl path/to/script
1060 The configuration information for the script is cached under the cabal directory
1061 and can be pre-built with ``cabal build path/to/script``.
1062 See ``cabal run`` for more information on scripts.
1064 .. option:: --enable-multi-repl
1066 Allow starting GHCi with multiple targets.
1067 This requires GHC with multiple home unit support (GHC-9.4+)
1069 The closure of required components will be loaded.
1071 .. option:: --disable-multi-repl
1073 Disallow starting GHCi with multiple targets. This reverts back to the behaviour
1074 in version 3.10 and earlier where only a single component can be loaded at
1082 ``cabal run [TARGET] [FLAGS] [-- EXECUTABLE_FLAGS]`` runs the executable
1083 specified by the target, which can be a component, a package or can be left
1084 blank, as long as it can uniquely identify an executable within the project.
1085 Tests and benchmarks are also treated as executables.
1087 See `the build section <#cabal-build>`__ for the target syntax.
1089 When ``TARGET`` is one of the following:
1091 - A component target: execute the specified executable, benchmark or test suite.
1094 1. If the package has exactly one executable component, it will be selected.
1095 2. If the package has multiple executable components, an error is raised.
1096 3. If the package has exactly one test or benchmark component, it will be selected.
1097 4. Otherwise an issue is raised.
1099 - The path to a script: execute the script at the path.
1101 - Empty target: Same as package target, implicitly using the package from the current
1104 Except in the case of the empty target, the strings after it will be
1105 passed to the executable as arguments.
1107 If one of the arguments starts with ``-`` it will be interpreted as
1108 a cabal flag, so if you need to pass flags to the executable you
1109 have to separate them with ``--``.
1113 $ cabal run target -- -a -bcd --argument
1115 ``run`` supports running script files that use a certain format.
1120 #!/usr/bin/env cabal
1122 build-depends: base ^>= 4.14
1126 with-compiler: ghc-8.10.7
1133 Where there cabal metadata block is mandatory and contains fields from a
1134 package executable block, and the project metadata block is optional and
1135 contains fields that would be in the cabal.project file in a regular project.
1137 Only some fields are supported in the metadata blocks, and these fields are
1138 currently not validated. See
1139 `#8024 <https://github.com/haskell/cabal/issues/8024>`__ for details.
1141 A script can either be executed directly using `cabal` as an interpreter or
1146 $ cabal run path/to/script
1148 The executable is cached under the cabal directory, and can be pre-built with
1149 ``cabal build path/to/script`` and the cache can be removed with
1150 ``cabal clean path/to/script``.
1152 The location of the cached executable can be displayed with
1153 ``cabal list-bin path/to/script``.
1155 A note on targets: Whenever a command takes a script target and it matches the
1156 name of another target, the other target is preferred. To load the script
1157 instead pass it as an explicit path: ./script
1159 By default, scripts are run at silent verbosity (``--verbose=0``). To show the
1160 build output for a script either use the command
1164 $ cabal run --verbose=n path/to/script
1166 or the interpreter line
1170 #!/usr/bin/env -S cabal run --verbose=n
1172 For more information see :cfg-field:`verbose`
1177 ``cabal bench [TARGETS] [FLAGS]`` runs the specified benchmarks
1178 (all the benchmarks in the current package by default), first ensuring
1179 they are up to date.
1181 ``cabal bench`` inherits flags of the ``bench`` subcommand of ``Setup.hs``,
1182 :ref:`see the corresponding section <setup-bench>`.
1187 ``cabal test [TARGETS] [FLAGS]`` tests test suites specified as targets
1188 after ensuring they are up to date and building them, if necessary.
1192 For a test suite, there's a difference between testing it with ``cabal
1193 test`` and running it with ``cabal run`` to do with the working directory.
1194 The former tests the test suite; that is to say that it "runs" the test suite
1195 from the package directory (from the directory of the package that has the
1196 test suite as a component), while the latter runs the test suite from
1197 whatever directory is current when the ``cabal run`` command is issued.
1198 This is important because the test suite may depend on files in the package
1199 directory, and so may not work correctly if run from another directory.
1203 Even though ``[TARGETS]`` are optional, ``cabal test`` will only test test
1204 suites without specifying a target if in the directory of a package,
1205 alongside a ``.cabal`` file. Being in the directory of a package implicitly
1206 selects that package for the test command.
1208 Taking the cabal project as an example that has a ``Cabal-tests`` package
1209 with multiple test suites, the following two commands are effectively the
1210 same and will test the test suites of the ``Cabal-tests`` package:
1214 $ cabal test Cabal-tests
1215 $ cd Cabal-tests && cabal test && cd ..
1217 If you want to test all of the test suites in a project then from the
1218 project directory ``cabal build`` with no target will fail:
1220 .. code-block:: text
1224 No targets given and there is no package in the current directory. Use
1225 the target 'all' for all packages in the project or specify packages or
1226 components by name or location. See 'cabal build --help' for more
1227 details on target options.
1229 Both ``cabal test all:tests`` and ``cabal test all`` use explicit targets
1230 for testing all test suites of a project; the former's ``all:tests`` target
1231 will select all test suites of the project, while the latter's ``all``
1232 target will select all packages of the project and, from those, test all
1235 ``cabal test`` inherits flags of the ``test`` subcommand of ``Setup.hs``
1236 (:ref:`see the corresponding section <setup-test>`) with one caveat: every
1237 ``Setup.hs test`` flag receives the ``test-`` prefix if it already does
1238 not have one; e.g. ``--show-details`` becomes ``--test-show-details`` but
1239 ``--test-wrapper`` remains the same.
1244 ``cabal exec [FLAGS] [--] COMMAND [--] [ARGS]`` runs the specified command
1245 using the project's environment. That is, passing the right flags to compiler
1246 invocations and bringing the project's executables into scope.
1248 .. _command-group-ship:
1250 Sanity checks and shipping
1251 --------------------------
1256 ``cabal check [FLAGS]`` checks the package for common mistakes (e.g.: if
1257 it is missing important fields like ``synopsis``, if it is using
1258 tricky GHC options, etc.).
1260 Run ``cabal check`` in the folder where your ``.cabal`` package file is.
1262 .. option:: -i, --ignore=WARNING
1264 Ignore a specific type of warning (e.g. ``--ignore=missing-upper-bounds``).
1265 Check the list of warnings for which constructor to use.
1267 .. option:: -v[n], --verbose[=n]
1269 Control verbosity (n is 0--3, default verbosity level is 1).
1271 Issues are classified as ``Warning``\s and ``Error``\s. The latter correspond
1272 to Hackage requirements for uploaded packages: if no error is reported,
1273 Hackage should accept your package. If errors are present ``cabal check``
1274 exits with ``1`` and Hackage will refuse the package.
1276 A list of all warnings with their constructor:
1278 - ``parser-warning``: inherited from parser.
1279 - ``no-name-field``: missing ``name`` field.
1280 - ``no-version-field``: missing ``version`` field.
1281 - ``no-target``: missing target in ``.cabal``.
1282 - ``unnamed-internal-library``: unnamed internal library.
1283 - ``duplicate-sections``: duplicate name in target.
1284 - ``illegal-library-name``: internal library with same name as package.
1285 - ``no-modules-exposed``: no module exposed in library.
1286 - ``signatures``: ``signatures`` used with ``cabal-version`` < 2.0.
1287 - ``autogen-not-exposed``: ``autogen-module`` neither in ``exposed-modules`` nor ``other-modules``.
1288 - ``autogen-not-included``: ``autogen-include`` neither in ``include`` nor ``install-includes``.
1289 - ``no-main-is``: missing ``main-is``.
1290 - ``unknown-extension-main``: ``main-is`` is not ``.hs`` nor ``.lhs``.
1291 - ``c-like-main``: C-like source file in ``main-is`` with ``cabal-version`` < 1.18.
1292 - ``autogen-other-modules``: ``autogen-module`` not in ``other-modules``.
1293 - ``autogen-exe``: ``autogen-include`` not in ``includes``.
1294 - ``unknown-testsuite-type``: unknown test-suite type.
1295 - ``unsupported-testsuite``: unsupported test-suite type.
1296 - ``unknown-bench``: unknown benchmark type.
1297 - ``unsupported-bench``: unsupported benchmark type.
1298 - ``bench-unknown-extension``: ``main-is`` for benchmark is neither ``.hs`` nor ``.lhs``.
1299 - ``invalid-name-win``: invalid package name on Windows.
1300 - ``reserved-z-prefix``: package with ``z-`` prexif (reseved for Cabal.
1301 - ``no-build-type``: missing ``build-type``.
1302 - ``undeclared-custom-setup``: ``custom-setup`` section without ``build-type: Custom``
1303 - ``unknown-compiler-tested``: unknown compiler in ``tested-with``.
1304 - ``unknown-languages``: unknown languages.
1305 - ``unknown-extension``: unknown extensions.
1306 - ``languages-as-extensions``: languages listed as extensions.
1307 - ``deprecated-extensions``: deprecated extensions.
1308 - ``no-category``: missing ``category`` field.
1309 - ``no-maintainer``: missing ``maintainer`` field.
1310 - ``no-synopsis``: missing ``synopsis`` field.
1311 - ``no-description``: missing ``description`` field.
1312 - ``no-syn-desc``: missing ``synopsis`` or ``description`` field.
1313 - ``long-synopsis``: ``synopsis`` longer than 80 characters.
1314 - ``short-description``: ``description`` shorter than ``synopsis``.
1315 - ``invalid-range-tested``: invalid ``tested-with`` version range.
1316 - ``impossible-dep``: impossible internal library version range dependency.
1317 - ``impossible-dep-exe``: impossible internal executable version range dependency.
1318 - ``no-internal-exe``: missing internal executable.
1319 - ``license-none``: ``NONE`` in ``license`` field.
1320 - ``no-license``: no ``license`` field.
1321 - ``all-rights-reserved``: “All rights reserved” license.
1322 - ``license-parse``: license not to be used with ``cabal-version`` < 1.4.
1323 - ``unknown-license``: unknown license.
1324 - ``bsd4-license``: uncommon BSD (BSD4) license.
1325 - ``unknown-license-version``: unknown license version.
1326 - ``no-license-file``: missing license file.
1327 - ``unrecognised-repo-type``: unrecognised kind of source-repository.
1328 - ``repo-no-type``: missing ``type`` in ``source-repository``.
1329 - ``repo-no-location``: missing ``location`` in ``source-repository``.
1330 - ``git-protocol``: using insecure ``git://`` protocol
1331 (`explanation <https://git-scm.com/book/en/v2/Git-on-the-Server-The-Protocols#_the_cons_4>`__
1333 - ``repo-no-module``: missing ``module`` in ``source-repository``.
1334 - ``repo-no-tag``: missing ``tag`` in ``source-repository``.
1335 - ``repo-relative-dir``: ``subdir`` in ``source-repository`` must be relative.
1336 - ``repo-malformed-subdir``: malformed ``subdir`` in ``source-repository``.
1337 - ``option-fasm``: unnecessary ``-fasm``.
1338 - ``option-fhpc``: unnecessary ``-fhpc``.
1339 - ``option-prof``: unnecessary ``-prof``.
1340 - ``option-o``: unnecessary ``-o``.
1341 - ``option-hide-package``: unnecessary ``-hide-package``.
1342 - ``option-make``: unnecessary ``--make``.
1343 - ``option-optimize``: unnecessary disable optimization flag.
1344 - ``option-o1``: unnecessary optimisation flag (``-O1``).
1345 - ``option-o2``: unnecessary optimisation flag (``-O2``).
1346 - ``option-split-section``: unnecessary ``-split-section``.
1347 - ``option-split-objs``: unnecessary ``-split-objs``.
1348 - ``option-optl-wl``:unnecessary ``-optl-Wl,-s``.
1349 - ``use-extension``: use ``extension`` field instead of ``-fglasgow-exts``.
1350 - ``option-rtsopts``: unnecessary ``-rtsopts``.
1351 - ``option-with-rtsopts``: unnecessary ``-with-rtsopts``.
1352 - ``option-opt-c``: unnecessary ``-O[n]`` in C code.
1353 - ``cpp-options``: unportable ``-cpp-options`` flag.
1354 - ``misplaced-c-opt``: C-like options in wrong cabal field.
1355 - ``relative-path-outside``: relative path outside of source tree.
1356 - ``absolute-path``: absolute path where not allowed.
1357 - ``malformed-relative-path``: malformed relative path.
1358 - ``unreliable-dist-path``: unreliable path pointing inside ``dist``.
1359 - ``glob-syntax-error``: glob syntax error.
1360 - ``recursive-glob``: recursive glob including source control folders.
1361 - ``invalid-path-win``: invalid path on Windows.
1362 - ``long-path``: path too long (POSIX, 255 ASCII chars).
1363 - ``long-name``: path *name* too long (POSIX, 100 ASCII chars).
1364 - ``name-not-portable``: path non portable (POSIX, split requirements).
1365 - ``empty-path``: empty path.
1366 - ``test-cabal-ver``: ``test-suite`` used with ``cabal-version`` < 1.10.
1367 - ``default-language``: ``default-language`` used with ``cabal-version`` < 1.10.
1368 - ``no-default-language``: missing ``default-language``.
1369 - ``add-default-language``: suggested ``default-language``.
1370 - ``extra-doc-files``: ``extra-doc-files`` used with ``cabal-version`` < 1.18.
1371 - ``multilib``: multiple ``library`` sections with ``cabal-version`` < 2.0.
1372 - ``reexported-modules``: ``reexported-modules`` with ``cabal-version`` < 1.22.
1373 - ``mixins``: ``mixins`` with ``cabal-version`` < 2.0.
1374 - ``extra-framework-dirs``: ``extra-framework-dirs`` with ``cabal-version`` < 1.24.
1375 - ``default-extensions``: ``default-extensions`` with ``cabal-version`` < 1.10.
1376 - ``extensions-field``: deprecated ``extensions`` field used with ``cabal-version`` ≥ 1.10
1377 - ``unsupported-sources``: ``asm-sources``, ``cmm-sources``, ``extra-bundled-libraries`` or ``extra-library-flavours`` used with ``cabal-version`` < 3.0.
1378 - ``extra-dynamic``: ``extra-dynamic-library-flavours`` used with cabal-version < 3.0.
1379 - ``virtual-modules``: ``virtual-modules`` used with cabal-version < 2.2.
1380 - ``source-repository``: ``source-repository`` used with ``cabal-version`` 1.6.
1381 - ``incompatible-extension``: incompatible language extension with ``cabal-version``.
1382 - ``no-setup-depends``: missing ``setup-depends`` field in ``custom-setup`` with ``cabal-version`` ≥ 1.24.
1383 - ``dependencies-setup``: missing dependencies in ``custom-setup`` with ``cabal-version`` ≥ 1.24.
1384 - ``no-autogen-paths``: missing autogen ``Paths_*`` modules in ``autogen-modules`` (``cabal-version`` ≥ 2.0).
1385 - ``no-autogen-pinfo``: missing autogen ``PackageInfo_*`` modules in ``autogen-modules`` *and* ``exposed-modules``/``other-modules`` (``cabal-version`` ≥ 2.0).
1386 - ``no-glob-match``: glob pattern not matching any file.
1387 - ``glob-no-extension``: glob pattern not matching any file becuase of lack of extension matching (`cabal-version` < 2.4).
1388 - ``glob-missing-dir``: glob pattern trying to match a missing directory.
1389 - ``unknown-os``: unknown operating system name in condition.
1390 - ``unknown-arch``: unknown architecture in condition.
1391 - ``unknown-compiler``: unknown compiler in condition.
1392 - ``missing-bounds-important``: missing upper bounds for important dependencies (``base``, and for ``custom-setup`` ``Cabal`` too).
1393 - ``missing-upper-bounds``: missing upper bound in dependency (excluding test-suites and benchmarks).
1394 - ``suspicious-flag``: troublesome flag name (e.g. starting with a dash).
1395 - ``unused-flag``: unused user flags.
1396 - ``non-ascii``: non-ASCII characters in custom field.
1397 - ``rebindable-clash-paths``: ``Rebindable Syntax`` with ``OverloadedStrings``/``OverloadedStrings`` plus autogenerated ``Paths_*`` modules with ``cabal-version`` < 2.2.
1398 - ``rebindable-clash-info``: ``Rebindable Syntax`` with ``OverloadedStrings``/``OverloadedStrings`` plus autogenerated ``PackageInfo_*`` modules with ``cabal-version`` < 2.2.
1399 - ``werror``: ``-WError`` not under a user flag.
1400 - ``unneeded-j``: suspicious ``-j[n]`` usage.
1401 - ``fdefer-type-errors``: suspicious ``-fdefer-type-errors``.
1402 - ``debug-flag``: suspicious ``-d*`` debug flag for distributed package.
1403 - ``fprof-flag``: suspicious ``-fprof-*`` flag.
1404 - ``missing-bounds-setup``: missing upper bounds in ``setup-depends``.
1405 - ``duplicate-modules``: duplicate modules in target.
1406 - ``maybe-duplicate-modules``: potential duplicate module in target (subject to conditionals).
1407 - ``bom``: unicode byte order mark (BOM) character at start of file.
1408 - ``name-no-match``: filename not matching ``name``.
1409 - ``no-cabal-file``: no ``.cabal`` file found in folder.
1410 - ``multiple-cabal-file``: multiple ``.cabal`` files found in folder.
1411 - ``unknown-file``: path refers to a file which does not exist.
1412 - ``missing-setup``: missing ``Setup.hs`` or ``Setup.lsh``.
1413 - ``missing-conf-script``: missing ``configure`` script with ``build-type: Configure``.
1414 - ``unknown-directory``: paths refer to a directory which does not exist.
1415 - ``no-repository``: missing ``source-repository`` section.
1416 - ``no-docs``: missing expected documentation files (changelog).
1417 - ``doc-place``: documentation files listed in ``extra-source-files`` instead of ``extra-doc-files``.
1424 ``cabal sdist [FLAGS] [PACKAGES]`` takes the crucial files needed to build ``PACKAGES``
1425 and puts them into an archive format ready for upload to Hackage. These archives are stable
1426 and two archives of the same format built from the same source will hash to the same value.
1428 ``cabal sdist`` takes the following flags:
1430 .. option:: -l, --list-only
1432 Rather than creating an archive, lists files that would be included.
1434 Output is to ``stdout`` by default. The file paths are relative to the project's root
1437 .. option:: -o PATH or -oPATH, --output-directory=PATH
1439 Sets the output dir, if a non-default one is desired. The default is
1440 ``dist-newstyle/sdist/``. ``--output-directory -`` will send output to ``stdout``
1441 unless multiple archives are being created.
1443 .. option:: --null-sep
1445 Only used with ``--list-only``. Separates filenames with a NUL
1446 byte instead of newlines.
1448 ``sdist`` is inherently incompatible with sdist hooks (which were removed in `Cabal-3.0`),
1449 not due to implementation but due to fundamental core invariants
1450 (same source code should result in the same tarball, byte for byte)
1451 that must be satisfied for it to function correctly in the larger build ecosystem.
1452 ``autogen-modules`` is able to replace uses of the hooks to add generated modules, along with
1453 the custom publishing of Haddock documentation to Hackage.
1458 ``cabal upload [FLAGS] TARFILES`` uploads source packages or documentation
1461 .. option:: --publish
1463 Publish the package immediately instead of uploading it as a
1464 `package candidate <https://hackage.haskell.org/upload#candidates>`__
1465 (make sure everything is fine, you cannot delete published packages
1468 .. option:: -d, --documentation
1470 Upload documentation instead of a source package. To upload
1471 documentation for a published package (and not a candidate), add
1474 .. option:: -t TOKEN or -tTOKEN, --token=TOKEN
1476 Your Hackage authentication token. You can create and delete
1477 authentication tokens on Hackage's `account management page
1478 <https://hackage.haskell.org/users/account-management>`__.
1480 .. option:: -u USERNAME or -uUSERNAME, --username=USERNAME
1482 Your Hackage username.
1484 .. option:: -p PASSWORD or -pPASSWORD, --password=PASSWORD
1486 Your Hackage password.
1488 .. option:: -P COMMAND or -PCOMMAND, --password-command=COMMAND
1490 Command to get your Hackage password. Arguments with whitespace
1491 must be quoted (double-quotes only). For example:
1495 --password-command='sh -c "grep hackage ~/secrets | cut -d : -f 2"'
1497 Or in the config file:
1501 password-command: sh -c "grep hackage ~/secrets | cut -d : -f 2"
1507 ``cabal report [FLAGS]`` uploads build reports to Hackage.
1509 .. option:: -t TOKEN or -tTOKEN, --token=TOKEN
1511 Your Hackage authentication token. You can create and delete
1512 authentication tokens on Hackage's `account management page
1513 <https://hackage.haskell.org/users/account-management>`__.
1515 .. option:: -u USERNAME or -uUSERNAME, --username=USERNAME
1517 Your Hackage username.
1519 .. option:: -p PASSWORD or -pPASSWORD, --password=PASSWORD
1521 Your Hackage password.
1523 .. include:: references.inc