Skip to content

cabal list-bin can already list multiple binary but just refuses to #9732

@andreabedini

Description

@andreabedini

cabal list-bin returns the path of a executable in the current project matching a specified target. E.g.

λ cabal list-bin cabal
/home/andrea/code/cabal/master/dist-newstyle/build/x86_64-linux/ghc-9.6.4/cabal-install-3.11.0.0/x/cabal/build/cabal/cabal

The command accepts one and only one target:

λ cabal list-bin
Error: cabal: One target is required, none provided
λ cabal list-bin cabal unit-tests
Error: cabal: One target is required, given multiple

The funny thing is that all is effectively one target, so cabal list-bin all almost works ...

λ cabal list-bin all
Error: cabal: The list-bin command is for finding a single binary at once. The
target 'all' refers to all the packages in the project which includes the
executable 'cabal', the executable 'test-runtime-deps', the executable
'setup', the executable 'cabal-tests', the executable 'hackage-benchmark', the
test suite 'unit-tests', the test suite 'rpmvercmp', the test suite
'parser-tests', the test suite 'no-thunks-test', the test suite
'hackage-tests', the test suite 'custom-setup-tests', the test suite
'check-tests', the test suite 'cabal-benchmarks', the test suite 'unit-tests',
the test suite 'mem-use-tests', the test suite 'long-tests', the test suite
'integration-tests2', the test suite 'unit-tests' and the test suite
'unit-tests'.

Combinations like all:tests and all:exes give a similar result:

λ cabal list-bin all:tests
Error: cabal: The list-bin command is for finding a single binary at once. The
target 'all:tests' refers to all the test suites in the project which includes
the test suite 'unit-tests', the test suite 'rpmvercmp', the test suite
'parser-tests', the test suite 'no-thunks-test', the test suite
'hackage-tests', the test suite 'custom-setup-tests', the test suite
'check-tests', the test suite 'cabal-benchmarks', the test suite 'unit-tests',
the test suite 'mem-use-tests', the test suite 'long-tests', the test suite
'integration-tests2', the test suite 'unit-tests' and the test suite
'unit-tests'.
λ cabal list-bin all:exes
Error: cabal: The list-bin command is for finding a single binary at once. The
target 'all:exes' refers to all the executables in the project which includes
the executable 'cabal', the executable 'test-runtime-deps', the executable
'setup', the executable 'cabal-tests' and the executable 'hackage-benchmark'.

The error lists all the matching targets so we must have a way to iterate over them!

@fendor

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions