Automate interactive CLI tools actions
Project description
pexpect-executor
Automate interactive CLI tools actions to create previews or tests in Python.
CLI examples
pexpect-executor --help
pexpect-executor --down --down --down --down --down --space --enter -- gitlabci-local -H -B
pexpect-executor --press a --press a --enter -- gitlabci-local
pexpect-executor --ctrl c -- gitlabci-local
Python examples
#!/usr/bin/env python3
# Modules libraries
from pexpect_executor import Executor
# Configure
Executor.configure(host='previews', tool='pexpect-executor')
# List
Executor('ls -la', workdir='/').\
finish()
# More
Executor('ls -la | more -5', delay_press=0.5, workdir='/').\
read().\
press('s').\
read().\
press('s').\
read().\
press('b').\
read().\
press('b').\
read().\
press(' ').\
read().\
wait(1).\
press(Executor.KEY_ENTER).\
read().\
wait(1).\
press('q').\
finish()
# Prompt
Executor('').\
finish()
Usage
Command | |
---|---|
pexpect-executor | Automate interactive CLI tools actions |
Positional arguments | |
---|---|
command | Command arguments to execute (use -- to separate) |
Optional arguments | |
---|---|
-h, --help | Show this help message |
--version | Show the current version |
--delay-init SECS | Delay the initial action execution (in s, default: 1.0) |
--delay-press SECS | Delay the press actions execution (in s, default: 0.5) |
--host HOST | Configure the host name (default: preview, env: EXECUTOR_HOST) |
--tool TOOL | Configure the tool name (default: executor, env: EXECUTOR_TOOL) |
--workdir WORKDIR | Use a specific working directory path |
--up | Press the <UP> key |
--down | Press the <DOWN> key |
--left | Press the <LEFT> key |
--right | Press the <RIGHT> key |
--enter | Press the <ENTER> key |
--space | Press the <SPACE> key |
--press KEY | Press the specified <KEY> |
--ctrl KEY | Press the specified Ctrl+<KEY> |
--read | Read the buffered data output (forced) |
--wait SECS | Wait the specified time (in s, example: 1.0) |
--finish | Finish the execution (forced) |
Dependencies
- colored: Terminal colors and styles
- pexpect: Interactive console applications controller
- setuptools: Build and manage Python packages
References
- git-chglog: CHANGELOG generator
- gitlab-release: Utility for publishing on GitLab
- gitlabci-local: Launch .gitlab-ci.yml jobs locally
- peek: Simple GIF screen recorder
- PyPI: The Python Package Index
- twine: Utility for publishing on PyPI
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
Close
Hashes for pexpect_executor-1.1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 03017845bb5b6e3d98ff0e1952038ff3d81482cc78acefe17709716dff068e8c |
|
MD5 | 3d1680ccb6b0cd2a495db2b58b6d943e |
|
BLAKE2b-256 | 42704e116e5ec888d1f1730d9beb4d24bfd8eaa5a291934ff376b7ca08c7500b |