stuffer.core module¶
-
class
stuffer.core.
Action
[source]¶ Bases:
stuffer.utils.NaturalReprMixin
Base class for actions to be taken.
Subclasses should override either command() or run(). If command() is overridden, it will get logged to stdout. If run() is overridden, the implementation should provide some form of logging.
-
command
() → Union[str, stuffer.content.DeferStr, List[str]][source]¶ Shell command to run. Override this or run().
Should either return a list of strings to pass to subprocess.check_output, or a string, in which case shell=True will be passed with subprocess.check_output..
-
-
class
stuffer.core.
ActionRegistry
[source]¶ Bases:
object
Singleton class to keep track of the created Actions.
-
class
stuffer.core.
Group
[source]¶ Bases:
stuffer.core.Action
Group of multiple actions to be executed.
-
stuffer.core.
run_cmd
(cmd: List[str], *args, **kwargs)[source]¶ Run a shell command and return the output.
- cmd
- List of command and arguments, passed to subprocess.check_output. If a string is passed, shell=True will be added to kwargs.
- args
- Extra arguments passed to subprocess.check_output
- kwargs
- Extra keyword arguments passed to subprocess.check_output
The output of the command
- subprocess.CalledProcessError
- On execution failure.