ICommandlib
Icommandlib is an interactive command line runner, designed (unlike pexpect) to be able to run command line applications in a virtual terminal window and take screenshots.
It was designed for building self rewriting, documentation generating tests like this for interactive command line apps with the hitchstory framework.
ICommandLib can take both terminal text screenshots and "stripshots" - terminal screenshots with all the white space to the right and bottom of the screen stripped.
Example
favoritecolor.py:
answer = input("favorite color:")
print(f"Your favorite color is {answer}")
answer = input("favorite movie:")
print(f"Your favorite color is {answer}")
With code:
from icommandlib import ICommand
from commandlib import python
from pathlib import Path
process = ICommand(python("favoritecolor.py")).run()
process.wait_until_output_contains("favorite color:")
process.send_keys("red\n")
process.wait_until_output_contains("favorite movie:")
process.send_keys("the usual suspects\n")
process.wait_until_on_screen("favorite color")
process.wait_for_successful_exit()
Path("stripshot.txt").write_text(process.stripshot())
- When the code is run to completion.
The file contents of stripshot.txt will then be:
Your favorite color is red
favorite movie:the usual suspects
Your favorite color is the usual suspects```
With height 4 and width 41.
## Install
```bash
$ pip install icommandlib
Using ICommandLib
Metadata
Release files for icommandlib 0.7.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| icommandlib-0.7.0.tar.gz | 9.6 kB | Without provenance | Details for icommandlib-0.7.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| icommandlib-0.7.0-py3-none-any.whl | Python 3 | none | any | Details for icommandlib-0.7.0-py3-none-any.whl |
Total release size: 18.7 kB
Release files / icommandlib-0.7.0.tar.gz
| Download URL | icommandlib-0.7.0.tar.gz |
|---|---|
| Size | 9.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
fd7fd9a306a7235426b21a5ed069d0c347aef85a1dcfca64755438eebe3e29b5
|
|
BLAKE2b-256 checksum How to use checksums |
a76b600c0b4e9b91b92be7baad866e365ea0be7a0558de63a6ea7a14d5bf4055
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.3
|
Release files / icommandlib-0.7.0-py3-none-any.whl
| Download URL | icommandlib-0.7.0-py3-none-any.whl |
|---|---|
| Size | 9.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
cd174fd5bb4963423a465d46d27a95d1db5decd09c7bb4df86dc09f5e52fa3e1
|
|
BLAKE2b-256 checksum How to use checksums |
ac81110ed27313087058cee5327fb1b7d94d6e3bf2086a2593c7985afaafd24c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.3
|
Security for icommandlib 0.7.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.