A simple wrapper for creating shell pipelines inside python scripts
Theoretically, this can be used across platforms, but there are a few conventions which do not translate well to Windows; i.e. sudo is difficult in a system that does not use multiple simultaneous users.
Collection of classes making up cmdflow. The main interface is ShellCmd.
To build a pipeline:
>>> pipeline = ShellCmd("echo 'foo'") | ShellCmd("grep 'f'")
>>> print pipeline
foo
Provides some methods for building paths. A nice feature is the ability to combine additional Path objects and/or strings to build a final path. Joining modifies the original Path. For example:
Path("/usr/local") / "bin" / "foo"
Initialize a Path object:
Path("/usr/local/")
Parameters: | pathname (string) – named path |
---|
Remove the path from the Filesystem
Manager of output from an executed cmdflow pipeline. Currently this can only redirect from the ShellCmd‘s stdnout to a file.
Parameters: | path_out – filesystem path to direct into |
---|
This is a wrapper on Popen to help make building pipelines of commands easier. The convenience syntax of ‘|’ is reminiscent of regular shell semantics but it is a bit different. In this case you must explicitly call the resulting object
Initialize a ShellCmd:
ShellCmd("echo 'hello'")
Parameters: |
|
---|
Allows ShellCmd objects to feed input into each other in a style similar to shell pipelines
Parameters: | b (ShellCmd) – command to append to ShellCmd.cmds |
---|
Being running ShellCmd pipeline
Parameters: | stdin (str or ShellCmd) – Passed into stdin in Popen‘s initializer |
---|---|
Return type: | ShellOutput |