Skip to main content

send commands into system terminal

Project description

Ver/TestedPython Ver/Os
repo/Created Commit/Last Tests/GitHubWorkflowStatus Tests/GitHubWorkflowStatus
repo/Size Commit/Count/t Commit/Count/y Commit/Count/m

cli_user (current v0.1.3/Ver/Pypi Latest)

DESCRIPTION_SHORT

send commands into system terminal

DESCRIPTION_LONG

Designed to send commands into OS terminal

Features

  1. send commands into OS terminal
  2. check if cli commands are accessible (special utilities is installed)
  3. access to standard parts of result in a simple ready-to-use form (stdout/stderr/retcode/full state)
  4. use batch timeout for list
  5. till_first_true
  6. 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


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)

Uploaded Source

Built Distribution

cli_user-0.1.3-py3-none-any.whl (7.0 kB view details)

Uploaded Python 3

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

Hashes for cli_user-0.1.3.tar.gz
Algorithm Hash digest
SHA256 fc2c079715c27a20d4469af5f4a7b691719ea34f690d9e2f98163ff564d29005
MD5 54ec9fc95538fb17cd262e1267611d61
BLAKE2b-256 8739cb0ea9629394ab05b6598be42df8891251627914c5c8a43a3ee4a8f9ce22

See more details on using hashes here.

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

Hashes for cli_user-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 46a901564b180418e577555de31c53d194b0e7dab143c0b5c0153e26e3e699f9
MD5 0ff0ed5b05cd2d8868e85a017af7bf32
BLAKE2b-256 b30e8eb53101e0dd458c4f2354c92bacf4b95730cad7a10fbdce9381b5deb5d3

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page