-
Notifications
You must be signed in to change notification settings - Fork 2k
Closed
Labels
Description
quietkwarg torun/sudo/localwhich:-
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:
if run("dpkg --list | grep packagename", quiet=True).failed: # install packagename
-
- maybe also a
warn_only()contextmanager shortcut tosettings(warn_only=True)?- first contextmanager with no parameterization, kinda ugly needing the parens still (unless I'm being dumb)
- edit: I guess it could be an instance of a contextmanager class. slightly longer definition code, but easier invoke.
- Maybe add on the output hiding so it's a contextmanager variant of
quiet?with quiet():?with silence()?
- first contextmanager with no parameterization, kinda ugly needing the parens still (unless I'm being dumb)
Reactions are currently unavailable