From 0f1e17df1ecf72b27171da3e0eed45b6a21a7dc0 Mon Sep 17 00:00:00 2001 From: Zoe Zuser Date: Sun, 19 May 2024 05:45:36 -0400 Subject: [PATCH] Add docs for list-bin support of scripts closes #7986 --- doc/cabal-commands.rst | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/doc/cabal-commands.rst b/doc/cabal-commands.rst index a5c3af693a1..5da0ec7a939 100644 --- a/doc/cabal-commands.rst +++ b/doc/cabal-commands.rst @@ -245,8 +245,8 @@ A cabal command target can take any of the following forms: component of which the given filepath is a part of will be built. - A script target: ``path/to/script``, which specifies the path to a script - file. This is supported by ``build``, ``repl``, ``run``, and ``clean``. - Script targets are not part of a package. + file. This is supported by ``build``, ``repl``, ``run``, ``list-bin``, and + ``clean``. Script targets are not part of a package. .. _command-group-global: @@ -970,6 +970,14 @@ We can also scope to test suite targets as they produce binaries. $ cabal list-bin cabal-install:unit-tests /.../dist-newstyle/.../unit-tests/unit-tests +It can also be used to display the location of the cached executable for a +cabal script. + +:: + + $ cabal list-bin path/to/script + $XDG_CACHE_HOME/cabal/script-builds/.../bin/script + Note that ``cabal list-bin`` will print the executables' location, but will not make sure that these executables actually exist (i.e., have been successfully built). In order to determine the correct location, @@ -1140,6 +1148,9 @@ The executable is cached under the cabal directory, and can be pre-built with ``cabal build path/to/script`` and the cache can be removed with ``cabal clean path/to/script``. +The location of the cached executable can be displayed with +``cabal list-bin path/to/script``. + A note on targets: Whenever a command takes a script target and it matches the name of another target, the other target is preferred. To load the script instead pass it as an explicit path: ./script