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.9/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.9.tar.gz (7.2 kB view details)

Uploaded Source

Built Distribution

cli_user-0.0.9-py3-none-any.whl (6.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: cli_user-0.0.9.tar.gz
  • Upload date:
  • Size: 7.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.0.9.tar.gz
Algorithm Hash digest
SHA256 778c188ea93207d8d2c1e059e88a72ce0ce23b30531a27bb19f0b152e2496a9a
MD5 73989307dab5bce33e466c3192206043
BLAKE2b-256 ead978bf3a1b94b518d7813e98735d26ed61632b75afd1eb859e2bb6a379b128

See more details on using hashes here.

File details

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

File metadata

  • Download URL: cli_user-0.0.9-py3-none-any.whl
  • Upload date:
  • Size: 6.6 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.9-py3-none-any.whl
Algorithm Hash digest
SHA256 17f829f2ab1ab82f2de68af1600fa397197ea62e5144ff7bf1f3bb6b33ea44c6
MD5 ee7acff0361bad145ba520c9f3ce4c37
BLAKE2b-256 685ec32f11c477e1705e03fa501ff93a8c9ca5737f2ebe8bee5d375a6ede3bc9

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