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

feature: print help for the subcommand when appropriate #1239

Open
ulysses4ever opened this issue Mar 5, 2025 · 2 comments
Open

feature: print help for the subcommand when appropriate #1239

ulysses4ever opened this issue Mar 5, 2025 · 2 comments

Comments

@ulysses4ever
Copy link
Contributor

Currently, if I do

$ ghcup list blah

(literally, i.e. a wrong argument blah for the subcommand list), I get the long generic help message about ghcup, i.e. the output of ghcup --help.

Feature request: print the output of ghcup list --help in this case.

I haven't checked all other subcommands, but e.g. set is funny:

$ ghcup set blah
...
[ Error ] [GHCup-00130] The version 'blah' of the tool ghc is not installed.

which is certainly not a nice message.

@hasufell
Copy link
Member

hasufell commented Mar 6, 2025

I don't think this is feasible.

ghcup set 9.8.4 is a shorthand for ghcup set ghc 9.8.4. Additionally, blah is a valid version. We don't enforce PVP, so that users can install different bindists side by side.

As such, I don't think we should be introducing special casing here.


Edit:

You also omitted part of the output, which clearly warns you're using on old command:

[ Warn ] This is an old-style command for setting GHC. Use 'ghcup set ghc' instead.

Then you execute ghcup set ghc blah and the error is exactly what we expect:

[ Error ] [GHCup-00130] The version 'blah' of the tool ghc is not installed.

But now that I think about it... what we could do is:

  • when we catch a "not installed" error AND
  • the tool version is not PVP compliant (we can trivially check), THEN
  • we can adjust the error message pointing to the fact that you might have misspelled something

@hasufell
Copy link
Member

hasufell commented Mar 6, 2025

$ /home/hasufell/git/ghcup-hs/dist-newstyle/build/x86_64-linux/ghc-9.6.7.20250131/ghcup-0.1.40.0/x/ghcup/build/ghcup/ghcup set blah
[ Warn  ] This is an old-style command for setting GHC. Use 'ghcup set ghc' instead.
[ Error ] [GHCup-00130] The version 'blah' of the tool ghc is not installed.
[ ...   ] The version you specified is not a PVP version. Did you misspell?

If that sounds reasonable, we have to figure out which subcommands (and combination of errors) should be adjusted for that behavior. I'm assuming it is not just set.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants