Skip to content

Getting --help to print descriptions for arguments #571

@reallyroy

Description

@reallyroy

Just wanted to check if there is a way to get Cobra to print help text for ARGS.

Say I have a CLI whose usage is:
do [SOMETHING]

I was wondering if it was possible to get do --help to print:

Usage:
    do [SOMETHING]
    [SOMETHING]: Allowed values are laundry, dishes or dinner

Flags:
   ....

The readme doesn't mention anything like this, and there are no examples on SetHelpTemplate, so I'm unsure if that is what needs to be used here. Would someone be able clarify if this is possible? And if not, are there any other options?

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/libMethods and functions that exist in the cobra library and consumed by userskind/featureA feature request for cobra; new or enhanced behavior

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions