Skip to content

progressbar(hide=True) option for hiding the progress bar #2609

@simonw

Description

@simonw

Often when I use the Click progressbar I find myself wanting to conditionally hide it. Sometimes it's because there's another option in play which means I have output to display in place of it - others it's because I added a --silent option (as seen in curl) for disabling it entirely.

It's actually a bit tricky doing this at the moment, due to its use as a context manager.

What I'd really like to be able to do is this:

hide = True  # or False depending on various things

with click.progressbar(items, show_eta=True, hide=hide):
    for item in items:
        process_item(item)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions