send commands into system terminal
Project description
cli_user (current v0.1.3/)
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, sourcecode and docstrings for other examples.
1. example1.py
from cli_user import *
print()
print()
print()
print()
victim = CliUser()
victim.send("ping localhost", timeout=0.1)
print()
# victim.print_state()
"""
[CLI_SEND] [ping localhost]
....
==================================================
[#####################ERROR#####################]
self.counter=1
self.counter_in_list=0
self.last_cmd='ping localhost'
self.last_duration=1.041
self.last_finished=True
self.last_finished_success=False
self.last_retcode=None
--------------------------------------------------
self.last_stdout=
|''
|'Обмен пакетами с starichenko.corp.element-t.ru [::1] с 32 байтами данных:'
|'Ответ от ::1: время<1мс '
|'Ответ от ::1: время<1мс '
|''
--------------------------------------------------
self.last_stderr=
--------------------------------------------------
self.last_exx_timeout=Exx_CliTimeout()
==================================================
"""
print()
print()
print()
print()
victim.send(["python --version", ("ping localhost", 0.1), ])
"""
[CLI_SEND] [python --version]
.
[CLI_SEND] [('ping localhost', 0.1)]
....
==================================================
[#####################ERROR#####################]
self.counter=3
self.counter_in_list=2
self.last_cmd='ping localhost'
self.last_duration=1.042
self.last_finished=True
self.last_finished_success=False
self.last_retcode=None
--------------------------------------------------
self.last_stdout=
|''
|'Обмен пакетами с starichenko.corp.element-t.ru [::1] с 32 байтами данных:'
|'Ответ от ::1: время<1мс '
|'Ответ от ::1: время<1мс '
|''
--------------------------------------------------
self.last_stderr=
--------------------------------------------------
self.last_exx_timeout=Exx_CliTimeout()
==================================================
[ERROR] cmd_item=('ping localhost', 0.1) in full sequence cmd=['python --version', ('ping localhost', 0.1)]
"""
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.1.3.tar.gz
(8.2 kB
view details)
Built Distribution
File details
Details for the file cli_user-0.1.3.tar.gz
.
File metadata
- Download URL: cli_user-0.1.3.tar.gz
- Upload date:
- Size: 8.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 | fc2c079715c27a20d4469af5f4a7b691719ea34f690d9e2f98163ff564d29005 |
|
MD5 | 54ec9fc95538fb17cd262e1267611d61 |
|
BLAKE2b-256 | 8739cb0ea9629394ab05b6598be42df8891251627914c5c8a43a3ee4a8f9ce22 |
File details
Details for the file cli_user-0.1.3-py3-none-any.whl
.
File metadata
- Download URL: cli_user-0.1.3-py3-none-any.whl
- Upload date:
- Size: 7.0 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 | 46a901564b180418e577555de31c53d194b0e7dab143c0b5c0153e26e3e699f9 |
|
MD5 | 0ff0ed5b05cd2d8868e85a017af7bf32 |
|
BLAKE2b-256 | b30e8eb53101e0dd458c4f2354c92bacf4b95730cad7a10fbdce9381b5deb5d3 |