Base class for creating modules that are bindings for command line tools.
Project description
morbin
Base class for creating modules that are bindings for command line tools.
Installation
Install with:
pip install morbin
Usage
The easiest way to start is to use the bundled template generator.
The only argument it requires is the name of the program you want to create bindings for.
As an example we'll do Git.
Running morbin git
in your terminal will produce a file named git.py
in your current directory.
It should look like this:
Additional functions should be built on top of this git
function and return its output.
After adding functions for git add
, git commit
, and git log
the class should look like this:
The Output
object each function returns is a dataclass
with three fields: return_code
, stdout
, and stderr
.
By default stdout
and stderr
are not captured.
They are sent to wherever they normally would be and the stdout
and stderr
fields of the Output
object will be empty strings.
stdout
and stderr
can be captured by either setting the capture_output
property of a class instance to True
or by using the capturing_output
context manager as demonstrated below:
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file morbin-0.0.0.tar.gz
.
File metadata
- Download URL: morbin-0.0.0.tar.gz
- Upload date:
- Size: 362.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d131f281747affa9d8892ca06906a8d88200e41ac1ddcde0114dfdf874646722 |
|
MD5 | 49e6d57ee17ca509f7f36379ddd4ac77 |
|
BLAKE2b-256 | 62885807bf651501d3670e5a5f82152c25a3ce66ad65332be8283ae5069045ca |
Provenance
File details
Details for the file morbin-0.0.0-py3-none-any.whl
.
File metadata
- Download URL: morbin-0.0.0-py3-none-any.whl
- Upload date:
- Size: 4.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 60ec792266838b5e9cedbfb775fb7665687574d9a9a7f5993cf83840b8047a82 |
|
MD5 | 18598c3d28e282077f3ec935cfe99047 |
|
BLAKE2b-256 | 65f430de5f4dc71676de3d8a46e4d858adea0b6ecdb5201519de58b46b0a3d70 |