Skip to content

Display help for all subcommands at the same time #1334

@mmstick

Description

@mmstick

Maintainer's note: Proposed solution

Setting:

  • help_includes_subcommands or help_shows_subcommands
    • trying to keep what the setting impacts first, otherwise I would have done flatten_subcommands_in_help
    • not starting with subcommand because this is set on the parent of the subcommands rather than a subcommand itself

Help output:

  • USAGE includes regular usage and usage for each subcommand that is visible in short help
  • Show current command's subcommand and arguments like normal
    • Even if parent has help_includes_subcommands set (this diverges from git stash <command> -h which shows git stash -h)
  • After current command's arguments, for each subcommand visible in short help
    • Show a header for the subcommand
    • Show short-help arguments under the above heading (ie ignore help headings)
      • Ideally, hide all generated and global arguments
    • Do not list subcommands

Man page:

  • Same as above but show long-help
  • This will actually be split out into a separate issue

Open question:

  • Do we recurse?
    • If so, we should elide intermediate subcommands that only have generated arguments

Implementation:

  • Usage generation will need to be refactored so we can request the parts of it that we need

The API is very large and I've struggled to find any examples or hints pointing to this possibility. Is it possible for the help page for a program to list the help pages of all subcommands at the same time, rather than just the current scope? That way the user does not need to also request for the help info from each subcommand.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-helpArea: documentation, including docs.rs, readme, examples, etc...C-enhancementCategory: Raise on the bar on expectationsS-waiting-on-decisionStatus: Waiting on a go/no-go before implementing

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions