send commands into system terminal
Project description
cli_user (v0.0.8)
DESCRIPTION_SHORT
send commands into system terminal
DESCRIPTION_LONG
Designed to send commands into OS terminal
Features
- send commands into OS terminal
- check if cli commands are accessible (special utilities is installed)
- access to standard parts of result in a simple ready-to-use form (stdout/stderr/retcode/full state)
- use batch timeout for list
- till_first_true
- counter/counter_in_list
License
See the LICENSE file for license rights and limitations (MIT).
Release history
See the HISTORY.md file for release history.
Installation
pip install cli-user
Import
from cli_user import *
USAGE EXAMPLES
See tests and sourcecode for other examples.
1. example1.py
from cli_user import *
victim = CliUser()
victim.send("ping localhost", timeout=0.1)
victim.print_state()
"""
==================================================
[#####################ERROR#####################]
self.counter=1
self.counter_in_list=0
self.last_cmd='ping localhost'
self.last_duration=0.109938
self.last_finished=True
self.last_finished_success=False
self.last_retcode=None
--------------------------------------------------
self.last_stdout=
--------------------------------------------------
self.last_stderr=
--------------------------------------------------
self.last_exx_timeout=Exx_CliTimeout("TimeoutExpired('ping localhost', 0.1)")
==================================================
"""
victim.send("python --version", timeout=1)
victim.print_state()
"""
==================================================
self.counter=2
self.counter_in_list=0
self.last_cmd='python --version'
self.last_duration=0.087947
self.last_finished=True
self.last_finished_success=True
self.last_retcode=0
--------------------------------------------------
self.last_stdout=
|'Python 3.12.1'
|''
--------------------------------------------------
self.last_stderr=
--------------------------------------------------
self.last_exx_timeout=None
==================================================
"""
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
cli_user-0.0.8.tar.gz
(6.2 kB
view details)
Built Distribution
File details
Details for the file cli_user-0.0.8.tar.gz
.
File metadata
- Download URL: cli_user-0.0.8.tar.gz
- Upload date:
- Size: 6.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.11.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d2ca351470d50baa4375ca93ebd58a40f9de16a2a1727b2abb0ffa9efcb34f14 |
|
MD5 | 20d99d2f076cfd52ed2c9b34324e1efd |
|
BLAKE2b-256 | 2460885a026f8fd5aa52079fa4b5a59cf1913406b93eda87e8cc98b2c2e4be10 |
File details
Details for the file cli_user-0.0.8-py3-none-any.whl
.
File metadata
- Download URL: cli_user-0.0.8-py3-none-any.whl
- Upload date:
- Size: 6.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.11.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2b1ae239d3d96db848b24cc9ae8d0c1b41f38177b7bcb02cb6ecb9f68767a77d |
|
MD5 | 92751140d70c280205eaeff9a6521728 |
|
BLAKE2b-256 | 186640fcf869c6de7f6e61f8cabe0df86904f624499eeb51c6fc4c4e260020c8 |