Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

argparse - document (and improve?) use of SUPPRESS with help= #56895

Closed
derks mannequin opened this issue Aug 3, 2011 · 5 comments
Closed

argparse - document (and improve?) use of SUPPRESS with help= #56895

derks mannequin opened this issue Aug 3, 2011 · 5 comments
Labels
docs Documentation in the Doc dir easy stdlib Python modules in the Lib dir type-feature A feature request or enhancement

Comments

@derks
Copy link
Mannequin

derks mannequin commented Aug 3, 2011

BPO 12686
Nosy @bitdancer, @akheron
Superseder
  • bpo-9349: document argparse's help=SUPPRESS
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2012-10-18.16:38:21.691>
    created_at = <Date 2011-08-03.07:23:40.459>
    labels = ['easy', 'type-feature', 'library', 'docs']
    title = 'argparse - document (and improve?) use of SUPPRESS with help='
    updated_at = <Date 2012-10-18.16:38:21.690>
    user = 'https://bugs.python.org/derks'

    bugs.python.org fields:

    activity = <Date 2012-10-18.16:38:21.690>
    actor = 'bethard'
    assignee = 'docs@python'
    closed = True
    closed_date = <Date 2012-10-18.16:38:21.691>
    closer = 'bethard'
    components = ['Documentation', 'Library (Lib)']
    creation = <Date 2011-08-03.07:23:40.459>
    creator = 'derks'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 12686
    keywords = ['easy']
    message_count = 5.0
    messages = ['141601', '141609', '149541', '173281', '173283']
    nosy_count = 5.0
    nosy_names = ['bethard', 'r.david.murray', 'docs@python', 'petri.lehtinen', 'derks']
    pr_nums = []
    priority = 'normal'
    resolution = 'duplicate'
    stage = 'needs patch'
    status = 'closed'
    superseder = '9349'
    type = 'enhancement'
    url = 'https://bugs.python.org/issue12686'
    versions = ['Python 3.3']

    @derks
    Copy link
    Mannequin Author

    derks mannequin commented Aug 3, 2011

    Having the ability to 'hide' positional/option arguments and subparsers in argparse would be useful. For example, I might want to add a subparser for 'somecommand-help' which would be a commands specifically for displaying help output of 'somecommand'. There is no reason I'd want to display this as an available argument... but rather simply add to the description "For more info try <command>-help".

    Something like:

    parser = argparse.ArgumentParser()
    sub = parser.add_subparsers()
    somecommand_help = sub.add_parser('somecommand-help', hide=True)

    OR

    parser.add_argument('--some-crazy-option', hide=True).

    It would then not display in the '--help' output, but would still function when 'somecommand-help' or '--some-crazy-option' is passed at command line. Would also be an extra bonus to add some sort of interface to 'list_hidden_arguments').

    @derks derks mannequin added the type-feature A feature request or enhancement label Aug 3, 2011
    @bitdancer
    Copy link
    Member

    This is partly a doc issue, but there also appear to be bugs in the way the existing functionality works (although it is hard to tell for sure since it isn't documented :)

    Try using the value argparse.SUPPRESS as the value of help= in various places and you'll see what I mean.

    @bitdancer bitdancer added docs Documentation in the Doc dir stdlib Python modules in the Lib dir easy labels Aug 3, 2011
    @bitdancer bitdancer changed the title argparse - add 'hide' feature argparse - document (and improve?) use of SUPPRESS with help= Aug 3, 2011
    @bethard
    Copy link
    Mannequin

    bethard mannequin commented Dec 15, 2011

    Could you give some examples of bugs that you observed? Otherwise, this looks like a duplicate of bpo-9349.

    The intention is that help=SUPPRESS should cause the given argument to not be displayed in the help message. If there are cases where that's not true, then it's definitely a bug.

    @akheron
    Copy link
    Member

    akheron commented Oct 18, 2012

    Can this be closed?

    @bethard
    Copy link
    Mannequin

    bethard mannequin commented Oct 18, 2012

    Yeah, looks like we can close this. If anyone finds a specific bug in the use of SUPPRESS, please open a new issue.

    @bethard bethard mannequin closed this as completed Oct 18, 2012
    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    docs Documentation in the Doc dir easy stdlib Python modules in the Lib dir type-feature A feature request or enhancement
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants