A simple windows command line interface wrapper for use with cli's
Project description
CmdInterface Class Documentation
Overview
The CmdInterface class provides a robust Python interface for interacting with command-line processes in Windows. It is designed to encapsulate command sending and output handling of a single terminal into a simple and clean API that can be easily integrated into larger applications.
Features
- Live Context: Changes in the terminal context by a command persist and the terminal is kept alive.
- Multiple Instances: Launching Multiple Instances at the same time does not create interference.
- Command Isolation: Ensures that commands sent through the interface are not executed at the same time if sent to the same instance, and outputs are cleanly separated.
- Boilerplate Removal: Automatically handles removal of unnecessary startup text from command outputs.
- Logging Capability: Offers optional logging of all commands and outputs for debugging and auditing purposes.
- Safe Cleanup: Automatically manages subprocess termination to prevent resource leaks.
Usage
Instantiation
Create an instance of the CmdInterface with optional configurations:
from cmdinterface.CmdInterface import CmdInterface
cmd = CmdInterface(nude=True, rm_boilerplate=True, end_signal="END_OF_OUTPUT", log_mode=False)
# Send commands and capture outputs
output_hello_world = cmd.send_command( "echo Hello, World!")
output_dir = cmd.send_command( "dir")
output_dir2 = cmd.send_command( "cd ..")
output_dir3 = cmd.send_command("dir")
# Output results
print("Output of 'Hello, World!':", ''.join(output_hello_world))
print("Output of 'dir':", ''.join(output_dir))
print("Output of 'dir2':", ''.join(output_dir2))
print("Output of 'dir3':", ''.join(output_dir3))
Project details
Release history Release notifications | RSS feed
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file simplecmdinterface-0.3.0.tar.gz.
File metadata
- Download URL: simplecmdinterface-0.3.0.tar.gz
- Upload date:
- Size: 3.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c9d31cb05f511c2a43e0b75a7f76c3d3a9b4345b54c9029abfcdf46cce5b106d
|
|
| MD5 |
f901247e6cd0083997515a6033b082d3
|
|
| BLAKE2b-256 |
8f9ff5f9a14279d0c208d1311ad5c1960745a36d32958d49146c9b82c4abc1db
|
File details
Details for the file simplecmdinterface-0.3.0-py3-none-any.whl.
File metadata
- Download URL: simplecmdinterface-0.3.0-py3-none-any.whl
- Upload date:
- Size: 3.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fa2f166f8270bbc320affab5f53d4d4e329f373d786b182ad76dd14a2d6de180
|
|
| MD5 |
da9d79118f97655208ff3dbd69fccebe
|
|
| BLAKE2b-256 |
973701b8690697c5b254f4361bc80e7907543695d7cdf4e44e7c2db927ea27be
|