Skip to content

CommandAction analogous with ArgAction allowing Custom "help" subcommand #6185

@jerusdp

Description

@jerusdp

Please complete the following tasks

Clap Version

4.5.51

Describe your use case

During discussion of the solution of implemention for #1553 the best solution to providing a custom header on the help sub-command was identified as requiring CommandAction with a help action analogous to the actions provided in ArgAction to generate a customhelp argument.

Describe the solution you'd like

Introduction

The objective is to provide the user with a facility to place the help subcommand under a custom header. Currently this can be worked around by renaming the default heading. Providing the user a CommandAction::Help will allow them to configure a custom help subcommand following the same process that is currently used to generate a custom help argument e.g. -?. The custom command can then be place under a custom header using Command::help_heading.

Design Statements

Statement Comment
MUST provide Command::CommandAction enum The key objective of the change
MUST provide help value for enum Commands with the help action will trigger help
MUST provide user value for enum Command with the user action must be handled by the user
MUST set the user action as the default
WILL NOT propagate custom help commands Not sure this is the right call ❓

Alternatives, if applicable

No response

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-builderArea: Builder APIA-parsingArea: Parser's logic and needs it changed somehow.C-enhancementCategory: Raise on the bar on expectationsS-triageStatus: New; needs maintainer attention.S-waiting-on-designStatus: Waiting on user-facing design to be resolved before implementing

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions