Skip to main content

send commands into system terminal

Project description

cli_user (v0.0.7)

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 *

victim = CliUser()
victim.send("ping localhost", timeout=0.1)
victim.print_state()
"""
==================================================
[#####################ERROR#####################]
self.counter=1
self.counter_in_list=0
self.last_cmd='ping localhost'
self.last_duration=0.109938
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)")
==================================================
"""

victim.send("python --version", timeout=1)
victim.print_state()
"""
==================================================
self.counter=2
self.counter_in_list=0
self.last_cmd='python --version'
self.last_duration=0.087947
self.last_finished=True
self.last_finished_success=True
self.last_retcode=0
--------------------------------------------------
self.last_stdout=
	|'Python 3.12.1'
	|''
--------------------------------------------------
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.7.tar.gz (5.9 kB view details)

Uploaded Source

Built Distribution

cli_user-0.0.7-py3-none-any.whl (6.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: cli_user-0.0.7.tar.gz
  • Upload date:
  • Size: 5.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.12.1

File hashes

Hashes for cli_user-0.0.7.tar.gz
Algorithm Hash digest
SHA256 8f8c9051ef35359970e48571a8612b5b52683ea37863b8ea3c85a4b6c97c7d94
MD5 057c1535d1a1cbbba5007a192ad4a562
BLAKE2b-256 ccdb2209583dfc426e589b855592bd1c528637847505a0eebafc2edc5487d194

See more details on using hashes here.

File details

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

File metadata

  • Download URL: cli_user-0.0.7-py3-none-any.whl
  • Upload date:
  • Size: 6.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.12.1

File hashes

Hashes for cli_user-0.0.7-py3-none-any.whl
Algorithm Hash digest
SHA256 28819d6ae0eaad738961e48a330fbc8d45dcbd6cf79322896caa60b7e0d76866
MD5 e56e7c33e00603677c5b6762f31b4bf1
BLAKE2b-256 9770bc990785608f9d23c8df5e10f61c1bc2168161ea9f0ed153eff62026d589

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