cabal list-bin can already list multiple binary but just refuses to
- Dominant language
- Haskell
- Stars
- 1.7k
- Forks
- 750
- Avg merge
- 4d 3h
- Merged PRs (30d)
- 28
Description
`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
Contributor guide
Assessment
This issue has not been assessed yet.