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)
Often when I use the Click
progressbarI 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--silentoption (as seen incurl) 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: