Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cabal is a poet #8189

Open
andreasabel opened this issue Jun 1, 2022 · 3 comments · Fixed by #8234 · May be fixed by #8989
Open

cabal is a poet #8189

andreasabel opened this issue Jun 1, 2022 · 3 comments · Fixed by #8234 · May be fixed by #8989
Assignees
Labels
cabal-install: cmd/run newcomer re: error-message Concerning error messages delivered to the user

Comments

@andreasabel
Copy link
Member

cabal-testsuite$ cabal run all -- --help
Error: cabal: The run command is for running a single executable at once. The
target 'all' refers to all the packages in the project which includes the
executable 'cabal', 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'.

Beautiful!

As much as we should teach our kids to communicate in full sentences, I would like cabal to answer me in tabular form:

cabal-testsuite$ cabal run all -- --help
Error: cabal: The run command is for running a single executable at once. The
target 'all' refers to all the packages in the project which includes:
- executables: cabal, setup, cabal-tests, hackage-benchmark
- test-suites:
  * unit-tests
  * rpmvercmp
  * parser-tests
  * no-thunks-test
  * hackage-tests
  * custom-tests
  * check-tests
  * cabal-benchmarks
  * mem-use-tests
  * long-tests
  * integration-tests2

(Short lists on one line, long lists one-item-per-line, no duplicates.)
One could also drop the punctuation:

- executables: cabal setup cabal-tests hackage-benchmark
- test-suites:
    unit-tests
    rpmvercmp
    parser-tests
    no-thunks-test
    hackage-tests
    custom-tests
    check-tests
    cabal-benchmarks
    mem-use-tests
    long-tests
    integration-tests2

Current pretty-printing frameworks do support separators which end up either horizontal or vertical, depending on the length of the list.

@ulysses4ever
Copy link
Collaborator

I observe very similar behavior with cabal list-bin, in particular:

❯ 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 test
suite 'mypkg-test-2' and the test suite 'mypkg-test'.

I wonder if #8234 could be extended for list-bin (and whether I should open a new ticket -- I just happen to love the title of this current ticket...). @mgsium, any thoughts on extending your PR to list-bin?

@mgsium
Copy link
Collaborator

mgsium commented May 17, 2023

I'd be happy to extend the PR. I see a few other uses of the old renderListCommaAnd formatting that may be worth looking at; the changes are probably simple enough not to warrant a new ticket but I'll leave it up to you.

@ulysses4ever ulysses4ever reopened this May 17, 2023
@ulysses4ever
Copy link
Collaborator

Awesome! Looking forward for it! And yeah, let's reuse the ticket. I can extend the description later...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cabal-install: cmd/run newcomer re: error-message Concerning error messages delivered to the user
Projects
None yet
3 participants