Skip to content

Problems with auto-created --help flag, -h flag, & help subcommand in generated completion scripts & help output #671

Open
@rgoldberg

Description

@rgoldberg

The following problems from an SAP-1.5.0-generated zsh completion script for the auto-created --help flag, the auto-created -h flag, & the auto-created help subcommand might occur for SAP-generated bash and/or fish scripts, too, but I'll just detail the problems seen in zsh.

I'm writing a command-line app that has subcommands (let's call it command).

SAP automatically created a help subcommand for command.

SAP also automatically created synonymous --help & -h top-level flags that output the same usage info as the help subcommand.

command --help|-h|help output

The auto-created help subcommand is not included in the subcommand list output by command --help, command -h, or command help. It should be inserted alphabetically into the list for each of the 3 commands.

command help <tab> completion

When I tab complete after a space after command help, the completion list is empty. If I manually type in command help subcommand, I get the help for subcommand.

The completion list after command help should thus include the list of subcommands.

command --help|-h <tab> completion

When I tab complete after a space after command --help or command -h, the completion list contains all the subcommands (including help).

All arguments after command --help or command -h, however, are ignored by SAP when the command is run; the command just outputs the top-level help, i.e. the list of subcommands along with top-level options.

The completion list after command --help or command -h should thus be empty.

I'd imagine that other top-level flags / options are ignored even if they're before --help or -h; if so, then the presence of any other flag / option / whatever should move --help & -h from any subsequent completion lists for the command / subcommand.

command subcommand --help|-h <tab> completion

SAP also auto-created --help & -h flags for each of my subcommands. The behavior of the top-level-command --help & -h flags should be replicated for the same two flags for each subcommand.

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