rails / thor

Thor is a toolkit for building powerful command-line interfaces.
http://whatisthor.com/
MIT License
5.12k stars 553 forks source link

Wrong cli argument should display more detailed command help #882

Closed benoittgt closed 1 month ago

benoittgt commented 1 month ago

Hello

While working on Thor command of a project I thought that on error on argument, Thor could be more helpful.

My proposal. Before

$ ruby enum_demo.rb start -v
ERROR: "enum_demo.rb start" was called with arguments ["-v"]
Usage: "enum_demo.rb start"

After

ruby enum_demo.rb start -v
ERROR: "enum_demo.rb start" was called with arguments ["-v"]

Usage:
  enum_demo.rb start

Options:
  -d, [--debug], [--no-debug], [--skip-debug]  
                                               # Default: false
  -h, [--help], [--no-help], [--skip-help]     
                                               # Default: false

Start the application

I already made a quick hack but before going further I would like to get some feedbacks about this idea of output.

The help output with Thor command seems to be a subject (https://github.com/rails/thor/issues/524, https://github.com/rails/thor/issues/402, https://github.com/rails/thor/issues/375, https://github.com/rails/thor/issues/661, etc). I am wondering if it would be wanted to fix some of issues. I can look at it, but first I would like to be sure about what we want to accept as a proper CLI help interface.

benoittgt commented 1 month ago

I'm gonna close this because it probably require more work than I did.