Skip to content

Thor::Group: disparities between cli help COMMAND and cli command --help #402

Open
@davidcelis

Description

@davidcelis

I'm building a CLI using Thor::Group to register commands and noticed that cli help command is not nearly as helpful as cli command --help. The longer description printed by using cli command --help shows the Thor::Group command's options, but cli help command does not. Also, cli command --help gives a weird (and wrong) command name. Lastly, the desc is only printed when running cli help command and not when running cli command --help (unless I duplicate the desc in the Thor::Group class itself)

My example code is at https://github.com/davidcelis/creperie where I'm building a CLI a la Rails has to create new Crepe applications. You can reproduce my example below:

$ git clone [email protected]:davidcelis/creperie.git
$ cd creperie
$ gem build creperie.gemspec
$ gem install creperie-0.0.1.pre.gem

$ crepe help new
Usage:
  crepe new [APP_NAME]

Create a new Crepe application.

$ crepe new --help
Usage:
  crepe creperie:generators:app APP_NAME

Options:
  -B, [--skip-bundle]  # Don't run bundle install
  -G, [--skip-git]     # Don't create a git repository
  -h, [--help]         # Print this usage information and exit

Runtime options:
  -f, [--force]    # Overwrite files that already exist
  -p, [--pretend]  # Run but do not make any changes
  -q, [--quiet]    # Suppress status output
  -s, [--skip]     # Skip files that already exist

Create a new Crepe application.

$ crepe creperie:generators:app
Could not find command "creperie:generators:app"

So, in summary:

  1. crepe help new prints very basic USAGE instructions despite being the help path given to users
  2. crepe new --help prints the desired USAGE instructions but is not discoverable
    • Related, if class_option :help isn't provided, --help (although clearly available as an option) is not listed under the Options banner despite it seemingly being available by default all the time.
  3. crepe new --help prints the wrong command name
  4. If desc is not duplicated inside of the Thor::Group class, the "Say hello!" description is only printed in cli help COMMAND and not cli COMMAND --help

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions