Convenience tweaks re: expected failures #627
Comments
Implemented Then went back and reread and realized I'd been thinking about primarily setting it up as a kwarg. This is probably smart because (at least IME) most uses of the pattern being aliased here wrap single run/sudo statements, not large blocks. Having a kwarg would thus prevent lots of needless extra lines+indents. OTOH having only a kwarg means that block level use is still not as easy as it could be. Here's a brainstorm of all possible related things we could add here:
I'm also not a huge fan of |
Gonna go with |
Implementation of the kwarg was mildly annoying as I didn't see any elegant solution besides literally using the contextmanager within |
Not entirely sure why I skipped out on a non-quiet warn-only option; sure it's not quite as common as the "fully quiet" use case, but there are still times when you want it, and "don't fail fast" is probably a concrete enough concept by itself to merit its own context manager & kwarg. Will see how complicated it is to add that in on top. EDIT: also, going with |
quiet
kwarg torun
/sudo
/local
which:hides everything
sets
warn_only=True
Use case: interrogative commands, whose result is often used as branching points in-code, where we don't usually want to see the output and do expect frequent failures.
Example:
warn_only()
contextmanager shortcut tosettings(warn_only=True)
?quiet
?with quiet():
?with silence()
?The text was updated successfully, but these errors were encountered: