Skip to content

Support help subcommand in addition to --help flag #6095

@schickling-assistant

Description

@schickling-assistant

Problem

Most CLI frameworks (Cobra, commander.js, git) automatically provide a help subcommand (e.g. mycli help subcmd) in addition to the --help flag. Currently @effect/cli only supports --help/-h flags.

The help subcommand pattern is valuable because:

  • Unambiguoustool help X is always a read-only help request. With flags, --help can be consumed as a value by a preceding option (e.g. tool commit -m --help might create a commit with message "--help" depending on the parser).
  • POSIX/GNU convention — users expect tool help to work.
  • Tooling-friendly — command authorization systems (e.g. proxies that allow/deny CLI operations) can trivially distinguish help ... as read-only without parsing flags, which is harder with --help embedded anywhere in the argument list.

Requested behavior

  • mycli help — shows top-level help (equivalent to mycli --help)
  • mycli help subcmd — shows subcommand help (equivalent to mycli subcmd --help)
  • mycli help nonexistent — shows an error listing available commands

Created on behalf of @schickling

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