roc: Update to clap 4 and improve subcommand typo error messages.

context: https://roc.zulipchat.com/#narrow/stream/231634-beginners/topic/CLI.20Error.20Message/near/356548857

Essentially, as a prereq for better error messages when a user mistypes a subcommand name, we need to first upgrade to clap 4. That will fix a bug in parsing related to requiring --. Currently when you mistype a subcommand name, parsing of the args fails. This means, we don’t get any chance to give a better error message.

So:

  1. upgrade to clap 4
  2. update to the new parsing without requiring --
  3. when someone tries to run a file and it isn’t found, check if the name is a typo of a sub command.
  4. give a nicer error.

About this issue

  • Original URL
  • State: open
  • Created a year ago
  • Comments: 16 (16 by maintainers)

Most upvoted comments

I guess for, we can keep all the args the same and just add the better error message for roc foromat .... Letting the user know they might have meant roc format ...

Thanks for weighing in, @bhansconnect and @rtfeldman!

@bhansconnect, https://github.com/roc-lang/roc/pull/5425 is ready for review.

I’d like to work on this.