Skip to content

Use of '--help' flag always results in exit, even when flags_help() is overriden #54

@Mar-Veloz

Description

@Mar-Veloz

Hi,

I'm trying to use shflags to write a script with several different subcommands, such as (for example) git has: git pull, git push, git merge, etc. As such, I'd like the --help flag to print help for that specific subcommand instead of one monolithic help message for everything.

The way I'm attempting to achieve this is by overriding the flags_help function to do nothing unless a non-empty $1 is passed to it, and having each specific subcommand manually check for the help flag. However, the problem with this is it seems when the library detects the help flag, it executes flags_help and then exits.

An easy solution seems to me to make the exit part of the flags_help function, so that the behavior can be overriden for those who don't wish for usage of the help flag to result in an immediate exit of the flags parser.

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions