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.1/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=0.122466
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)")
==================================================

==================================================
[#####################ERROR#####################]
self.counter=1
self.counter_in_list=0
self.last_cmd='ping localhost'
self.last_duration=0.122466
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)")
==================================================
"""

print()
print()
print()
print()
victim.send("python --version", timeout=1)
print()
victim.print_state()
"""
[CLI_SEND] [python --version]

==================================================
self.counter=2
self.counter_in_list=0
self.last_cmd='python --version'
self.last_duration=0.044547
self.last_finished=True
self.last_finished_success=True
self.last_retcode=0
--------------------------------------------------
self.last_stdout=
	|'Python 3.11.7'
	|''
--------------------------------------------------
self.last_stderr=
--------------------------------------------------
self.last_exx_timeout=None
==================================================
"""

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.1.tar.gz (8.0 kB view details)

Uploaded Source

Built Distribution

cli_user-0.1.1-py3-none-any.whl (6.8 kB view details)

Uploaded Python 3

File details

Details for the file cli_user-0.1.1.tar.gz.

File metadata

  • Download URL: cli_user-0.1.1.tar.gz
  • Upload date:
  • Size: 8.0 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.1.tar.gz
Algorithm Hash digest
SHA256 8e9b593108ea15700f5922c81365f9343885b8c0422dfd8cbd35e0481f68a9fe
MD5 efa8f77d76a66968232d054f09efdd3d
BLAKE2b-256 e6c2efa5d385973b86a592741c6c08de7398f0ae2476d3198bc8c7c44d7f4d2b

See more details on using hashes here.

File details

Details for the file cli_user-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: cli_user-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 6.8 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 654ad6cfe602d007344a91f227ad695bd883e9ef254573a2d77c352438358b99
MD5 02cbf674241244be8a577f061622822e
BLAKE2b-256 3a97391b17c1f078d4b976cbb867f010c75388dae0773db82c5e8febe36a7d6e

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