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.0.11/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 and sourcecode 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.0.11.tar.gz (8.0 kB view details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: cli_user-0.0.11.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.0.11.tar.gz
Algorithm Hash digest
SHA256 42cc2c61626fe6065d32b608b921c5f7ce6ea81321f765dee5951d2b28d247e1
MD5 d00d4eb4316a78415b6ca500da0d4259
BLAKE2b-256 50c8b07c973c1bf65890f18e27430460fec3b52215d29bf39fa704f7530ccb68

See more details on using hashes here.

File details

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

File metadata

  • Download URL: cli_user-0.0.11-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.0.11-py3-none-any.whl
Algorithm Hash digest
SHA256 31a98c598d4a89a802b6f2e236fd796bbc9c817cb53a57cbd2b3e7ef1ae53f3b
MD5 6467ab3f2d3969b4bea9b2f86881b53a
BLAKE2b-256 8e16e614029846cd8c0f980992475e2f03495f099d18ca96c870467c3971f6eb

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