pexpect-executor


Namepexpect-executor JSON
Version 4.2.0 PyPI version JSON
download
home_pagehttps://gitlab.com/RadianDevCore/tools/pexpect-executor
SummaryAutomate interactive CLI tools actions
upload_time2024-10-28 22:24:27
maintainerNone
docs_urlNone
authorAdrian DC
requires_python!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*,!=3.7.*,>=3
licenseApache License 2.0
keywords pexpect pexpect-executor
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # pexpect-executor

[![Release](https://img.shields.io/pypi/v/pexpect-executor?color=blue)](https://pypi.org/project/pexpect-executor)
[![Python](https://img.shields.io/pypi/pyversions/pexpect-executor?color=blue)](https://pypi.org/project/pexpect-executor)
[![Downloads](https://img.shields.io/pypi/dm/pexpect-executor?color=blue)](https://pypi.org/project/pexpect-executor)
[![License](https://img.shields.io/gitlab/license/RadianDevCore/tools/pexpect-executor?color=blue)](https://gitlab.com/RadianDevCore/tools/pexpect-executor/-/blob/main/LICENSE)
<br />
[![Build](https://gitlab.com/RadianDevCore/tools/pexpect-executor/badges/main/pipeline.svg)](https://gitlab.com/RadianDevCore/tools/pexpect-executor/-/commits/main/)
[![Bugs](https://sonarcloud.io/api/project_badges/measure?project=RadianDevCore_pexpect-executor&metric=bugs)](https://sonarcloud.io/dashboard?id=RadianDevCore_pexpect-executor)
[![Code Smells](https://sonarcloud.io/api/project_badges/measure?project=RadianDevCore_pexpect-executor&metric=code_smells)](https://sonarcloud.io/dashboard?id=RadianDevCore_pexpect-executor)
[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=RadianDevCore_pexpect-executor&metric=coverage)](https://sonarcloud.io/dashboard?id=RadianDevCore_pexpect-executor)
[![Lines of Code](https://sonarcloud.io/api/project_badges/measure?project=RadianDevCore_pexpect-executor&metric=ncloc)](https://sonarcloud.io/dashboard?id=RadianDevCore_pexpect-executor)
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=RadianDevCore_pexpect-executor&metric=alert_status)](https://sonarcloud.io/dashboard?id=RadianDevCore_pexpect-executor)
<br />
[![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit)](https://github.com/pre-commit/pre-commit)
[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](https://commitizen-tools.github.io/commitizen/)
[![gcil](https://img.shields.io/badge/gcil-enabled-brightgreen?logo=gitlab)](https://radiandevcore.gitlab.io/tools/gcil)
[![pre-commit-crocodile](https://img.shields.io/badge/pre--commit--crocodile-enabled-brightgreen?logo=gitlab)](https://radiandevcore.gitlab.io/tools/pre-commit-crocodile)

Automate interactive CLI tools actions to create previews or tests in Python.

**Documentation:** <https://radiandevcore.gitlab.io/tools/pexpect-executor>  
**Package:** <https://pypi.org/project/pexpect-executor/>

---

## Preview

![preview.svg](https://gitlab.com/RadianDevCore/tools/pexpect-executor/raw/4.2.0/docs/preview.svg)

---

## CLI examples

```bash
pexpect-executor --help
pexpect-executor --down --down --down --down --down --space --enter -- gcil -H -B
pexpect-executor --press a --press a --enter -- gcil
pexpect-executor --ctrl c -- gcil
```

---

<span class="page-break"></span>

## Python examples

```python
#!/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()
```

---

<span class="page-break"></span>

## Usage

<!-- prettier-ignore-start -->
<!-- readme-help-start -->

```yaml
usage: pexpect-executor [-h] [--version] [--no-color] [--update-check] [--settings] [--set GROUP KEY VAL]
                        [--delay-init SECS] [--delay-press SECS] [--delay-prompt SECS] [--hold-prompt] [--host HOST]
                        [--tool TOOL] [--mask STRINGS] [--workdir WORKDIR] [--up] [--down] [--left] [--right]
                        [--enter] [--space] [--press KEY] [--ctrl KEY] [--read] [--wait SECS] [--finish] [--]
                        [command ...]

pexpect-executor: Automate interactive CLI tools actions

internal arguments:
  -h, --help           # Show this help message
  --version            # Show the current version
  --no-color           # Disable colors outputs with 'NO_COLOR=1'
                       # (or default settings: [themes] > no_color)
  --update-check       # Check for newer package updates
  --settings           # Show the current settings path and contents
  --set GROUP KEY VAL  # Set settings specific 'VAL' value to [GROUP] > KEY
                       # or unset by using 'UNSET' as 'VAL'

configuration arguments:
  --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)
  --delay-prompt SECS  # Delay the prompt actions execution (in s, default: 1.0)
  --hold-prompt        # Hold the prompt execution without a new line
  --host HOST          # Configure the host name (default: preview, env: EXECUTOR_HOST)
  --tool TOOL          # Configure the tool name (default: executor, env: EXECUTOR_TOOL)
  --mask STRINGS       # Mask specific strings from console outputs (credentials for example)
  --workdir WORKDIR    # Use a specific working directory path

actions arguments:
  --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)

positional arguments:
  --                   # Positional arguments separator (recommended)
  command              # Command arguments to execute (use -- to separate)
```

<!-- readme-help-stop -->
<!-- prettier-ignore-end -->

---

<span class="page-break"></span>

## Userspace available settings

`pexpect-executor` creates a `settings.ini` configuration file in a userspace folder.

For example, it allows to disable the automated updates daily check (`[updates] > enabled`)

The `settings.ini` file location and contents can be shown with the following command:

```bash
pexpect-executor --settings
```

---

## Supported systems

|     Systems      | Supported |
| :--------------: | :-------: |
|  Linux (shell)   |   **✓**   |
|  macOS (shell)   |   **?**   |
| Windows (shell)  |   **~**   |
| Android (Termux) |   **✓**   |

---

<span class="page-break"></span>

## Dependencies

- [colored](https://pypi.org/project/colored/): Terminal colors and styles
- [pexpect](https://pypi.org/project/pexpect/): Interactive console applications controller
- [setuptools](https://pypi.org/project/setuptools/): Build and manage Python packages
- [update-checker](https://pypi.org/project/update-checker/): Check for package updates on PyPI
- [wexpect](https://pypi.org/project/wexpect/): Windows alternative of pexpect

---

## References

- [commitizen](https://pypi.org/project/commitizen/): Simple commit conventions for internet citizens
- [git-cliff](https://github.com/orhun/git-cliff): CHANGELOG generator
- [gitlab-release](https://pypi.org/project/gitlab-release/): Utility for publishing on GitLab
- [gcil](https://radiandevcore.gitlab.io/tools/gcil): Launch .gitlab-ci.yml jobs locally
- [mkdocs](https://www.mkdocs.org/): Project documentation with Markdown
- [mkdocs-exporter](https://adrienbrignon.github.io/mkdocs-exporter/): Exporter plugin for mkdocs documentation
- [mkdocs-material](https://squidfunk.github.io/mkdocs-material/): Material theme for mkdocs documentation
- [mypy](https://pypi.org/project/mypy/): Optional static typing for Python
- [pre-commit](https://pre-commit.com/): A framework for managing and maintaining pre-commit hooks
- [pre-commit-crocodile](https://radiandevcore.gitlab.io/tools/pre-commit-crocodile): Git hooks intended for developers using pre-commit
- [PyPI](https://pypi.org/): The Python Package Index
- [termtosvg](https://pypi.org/project/termtosvg/): Record terminal sessions as SVG animations
- [twine](https://pypi.org/project/twine/): Utility for publishing on PyPI

            

Raw data

            {
    "_id": null,
    "home_page": "https://gitlab.com/RadianDevCore/tools/pexpect-executor",
    "name": "pexpect-executor",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*,!=3.7.*,>=3",
    "maintainer_email": null,
    "keywords": "pexpect pexpect-executor",
    "author": "Adrian DC",
    "author_email": "radian.dc@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/92/55/03278150a1d8a78022aeed579b54570fe32a4e1b53d82cf97fd762ca310a/pexpect_executor-4.2.0.tar.gz",
    "platform": null,
    "description": "# pexpect-executor\n\n[![Release](https://img.shields.io/pypi/v/pexpect-executor?color=blue)](https://pypi.org/project/pexpect-executor)\n[![Python](https://img.shields.io/pypi/pyversions/pexpect-executor?color=blue)](https://pypi.org/project/pexpect-executor)\n[![Downloads](https://img.shields.io/pypi/dm/pexpect-executor?color=blue)](https://pypi.org/project/pexpect-executor)\n[![License](https://img.shields.io/gitlab/license/RadianDevCore/tools/pexpect-executor?color=blue)](https://gitlab.com/RadianDevCore/tools/pexpect-executor/-/blob/main/LICENSE)\n<br />\n[![Build](https://gitlab.com/RadianDevCore/tools/pexpect-executor/badges/main/pipeline.svg)](https://gitlab.com/RadianDevCore/tools/pexpect-executor/-/commits/main/)\n[![Bugs](https://sonarcloud.io/api/project_badges/measure?project=RadianDevCore_pexpect-executor&metric=bugs)](https://sonarcloud.io/dashboard?id=RadianDevCore_pexpect-executor)\n[![Code Smells](https://sonarcloud.io/api/project_badges/measure?project=RadianDevCore_pexpect-executor&metric=code_smells)](https://sonarcloud.io/dashboard?id=RadianDevCore_pexpect-executor)\n[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=RadianDevCore_pexpect-executor&metric=coverage)](https://sonarcloud.io/dashboard?id=RadianDevCore_pexpect-executor)\n[![Lines of Code](https://sonarcloud.io/api/project_badges/measure?project=RadianDevCore_pexpect-executor&metric=ncloc)](https://sonarcloud.io/dashboard?id=RadianDevCore_pexpect-executor)\n[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=RadianDevCore_pexpect-executor&metric=alert_status)](https://sonarcloud.io/dashboard?id=RadianDevCore_pexpect-executor)\n<br />\n[![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit)](https://github.com/pre-commit/pre-commit)\n[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](https://commitizen-tools.github.io/commitizen/)\n[![gcil](https://img.shields.io/badge/gcil-enabled-brightgreen?logo=gitlab)](https://radiandevcore.gitlab.io/tools/gcil)\n[![pre-commit-crocodile](https://img.shields.io/badge/pre--commit--crocodile-enabled-brightgreen?logo=gitlab)](https://radiandevcore.gitlab.io/tools/pre-commit-crocodile)\n\nAutomate interactive CLI tools actions to create previews or tests in Python.\n\n**Documentation:** <https://radiandevcore.gitlab.io/tools/pexpect-executor>  \n**Package:** <https://pypi.org/project/pexpect-executor/>\n\n---\n\n## Preview\n\n![preview.svg](https://gitlab.com/RadianDevCore/tools/pexpect-executor/raw/4.2.0/docs/preview.svg)\n\n---\n\n## CLI examples\n\n```bash\npexpect-executor --help\npexpect-executor --down --down --down --down --down --space --enter -- gcil -H -B\npexpect-executor --press a --press a --enter -- gcil\npexpect-executor --ctrl c -- gcil\n```\n\n---\n\n<span class=\"page-break\"></span>\n\n## Python examples\n\n```python\n#!/usr/bin/env python3\n\n# Modules libraries\nfrom pexpect_executor import Executor\n\n# Configure\nExecutor.configure(host='previews', tool='pexpect-executor')\n\n# List\nExecutor('ls -la', workdir='/').\\\n    finish()\n\n# More\nExecutor('ls -la | more -5', delay_press=0.5, workdir='/').\\\n    read().\\\n    press('s').\\\n    read().\\\n    press('s').\\\n    read().\\\n    press('b').\\\n    read().\\\n    press('b').\\\n    read().\\\n    press(' ').\\\n    read().\\\n    wait(1).\\\n    press(Executor.KEY_ENTER).\\\n    read().\\\n    wait(1).\\\n    press('q').\\\n    finish()\n\n# Prompt\nExecutor('').\\\n    finish()\n```\n\n---\n\n<span class=\"page-break\"></span>\n\n## Usage\n\n<!-- prettier-ignore-start -->\n<!-- readme-help-start -->\n\n```yaml\nusage: pexpect-executor [-h] [--version] [--no-color] [--update-check] [--settings] [--set GROUP KEY VAL]\n                        [--delay-init SECS] [--delay-press SECS] [--delay-prompt SECS] [--hold-prompt] [--host HOST]\n                        [--tool TOOL] [--mask STRINGS] [--workdir WORKDIR] [--up] [--down] [--left] [--right]\n                        [--enter] [--space] [--press KEY] [--ctrl KEY] [--read] [--wait SECS] [--finish] [--]\n                        [command ...]\n\npexpect-executor: Automate interactive CLI tools actions\n\ninternal arguments:\n  -h, --help           # Show this help message\n  --version            # Show the current version\n  --no-color           # Disable colors outputs with 'NO_COLOR=1'\n                       # (or default settings: [themes] > no_color)\n  --update-check       # Check for newer package updates\n  --settings           # Show the current settings path and contents\n  --set GROUP KEY VAL  # Set settings specific 'VAL' value to [GROUP] > KEY\n                       # or unset by using 'UNSET' as 'VAL'\n\nconfiguration arguments:\n  --delay-init SECS    # Delay the initial action execution (in s, default: 1.0)\n  --delay-press SECS   # Delay the press actions execution (in s, default: 0.5)\n  --delay-prompt SECS  # Delay the prompt actions execution (in s, default: 1.0)\n  --hold-prompt        # Hold the prompt execution without a new line\n  --host HOST          # Configure the host name (default: preview, env: EXECUTOR_HOST)\n  --tool TOOL          # Configure the tool name (default: executor, env: EXECUTOR_TOOL)\n  --mask STRINGS       # Mask specific strings from console outputs (credentials for example)\n  --workdir WORKDIR    # Use a specific working directory path\n\nactions arguments:\n  --up                 # Press the <UP> key\n  --down               # Press the <DOWN> key\n  --left               # Press the <LEFT> key\n  --right              # Press the <RIGHT> key\n  --enter              # Press the <ENTER> key\n  --space              # Press the <SPACE> key\n  --press KEY          # Press the specified <KEY>\n  --ctrl KEY           # Press the specified Ctrl+<KEY>\n  --read               # Read the buffered data output (forced)\n  --wait SECS          # Wait the specified time (in s, example: 1.0)\n  --finish             # Finish the execution (forced)\n\npositional arguments:\n  --                   # Positional arguments separator (recommended)\n  command              # Command arguments to execute (use -- to separate)\n```\n\n<!-- readme-help-stop -->\n<!-- prettier-ignore-end -->\n\n---\n\n<span class=\"page-break\"></span>\n\n## Userspace available settings\n\n`pexpect-executor` creates a `settings.ini` configuration file in a userspace folder.\n\nFor example, it allows to disable the automated updates daily check (`[updates] > enabled`)\n\nThe `settings.ini` file location and contents can be shown with the following command:\n\n```bash\npexpect-executor --settings\n```\n\n---\n\n## Supported systems\n\n|     Systems      | Supported |\n| :--------------: | :-------: |\n|  Linux (shell)   |   **\u2713**   |\n|  macOS (shell)   |   **?**   |\n| Windows (shell)  |   **~**   |\n| Android (Termux) |   **\u2713**   |\n\n---\n\n<span class=\"page-break\"></span>\n\n## Dependencies\n\n- [colored](https://pypi.org/project/colored/): Terminal colors and styles\n- [pexpect](https://pypi.org/project/pexpect/): Interactive console applications controller\n- [setuptools](https://pypi.org/project/setuptools/): Build and manage Python packages\n- [update-checker](https://pypi.org/project/update-checker/): Check for package updates on PyPI\n- [wexpect](https://pypi.org/project/wexpect/): Windows alternative of pexpect\n\n---\n\n## References\n\n- [commitizen](https://pypi.org/project/commitizen/): Simple commit conventions for internet citizens\n- [git-cliff](https://github.com/orhun/git-cliff): CHANGELOG generator\n- [gitlab-release](https://pypi.org/project/gitlab-release/): Utility for publishing on GitLab\n- [gcil](https://radiandevcore.gitlab.io/tools/gcil): Launch .gitlab-ci.yml jobs locally\n- [mkdocs](https://www.mkdocs.org/): Project documentation with Markdown\n- [mkdocs-exporter](https://adrienbrignon.github.io/mkdocs-exporter/): Exporter plugin for mkdocs documentation\n- [mkdocs-material](https://squidfunk.github.io/mkdocs-material/): Material theme for mkdocs documentation\n- [mypy](https://pypi.org/project/mypy/): Optional static typing for Python\n- [pre-commit](https://pre-commit.com/): A framework for managing and maintaining pre-commit hooks\n- [pre-commit-crocodile](https://radiandevcore.gitlab.io/tools/pre-commit-crocodile): Git hooks intended for developers using pre-commit\n- [PyPI](https://pypi.org/): The Python Package Index\n- [termtosvg](https://pypi.org/project/termtosvg/): Record terminal sessions as SVG animations\n- [twine](https://pypi.org/project/twine/): Utility for publishing on PyPI\n",
    "bugtrack_url": null,
    "license": "Apache License 2.0",
    "summary": "Automate interactive CLI tools actions",
    "version": "4.2.0",
    "project_urls": {
        "Bug Reports": "https://gitlab.com/RadianDevCore/tools/pexpect-executor/-/issues",
        "Changelog": "https://gitlab.com/RadianDevCore/tools/pexpect-executor/blob/main/CHANGELOG.md",
        "Documentation": "https://gitlab.com/RadianDevCore/tools/pexpect-executor#pexpect-executor",
        "Homepage": "https://gitlab.com/RadianDevCore/tools/pexpect-executor",
        "Source": "https://gitlab.com/RadianDevCore/tools/pexpect-executor",
        "Statistics": "https://pypistats.org/packages/pexpect-executor"
    },
    "split_keywords": [
        "pexpect",
        "pexpect-executor"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "703054e43fe8e6d3a8f78923dd55e6db9b0a56fb808cc23806e6109f4b9ae33b",
                "md5": "74b7530df4c1b6534d0e67f49baef905",
                "sha256": "18e7718095b6ea235063ef0307de88c5ba4b2557f9a78034f370c1d5b87794af"
            },
            "downloads": -1,
            "filename": "pexpect_executor-4.2.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "74b7530df4c1b6534d0e67f49baef905",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*,!=3.7.*,>=3",
            "size": 29997,
            "upload_time": "2024-10-28T22:24:26",
            "upload_time_iso_8601": "2024-10-28T22:24:26.334139Z",
            "url": "https://files.pythonhosted.org/packages/70/30/54e43fe8e6d3a8f78923dd55e6db9b0a56fb808cc23806e6109f4b9ae33b/pexpect_executor-4.2.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "925503278150a1d8a78022aeed579b54570fe32a4e1b53d82cf97fd762ca310a",
                "md5": "18ffc8c0cfad29337c22d41eadf1ccc0",
                "sha256": "ebf80bc77183f951503574b24ce504337b568a946c76e62144a095253bab4e4b"
            },
            "downloads": -1,
            "filename": "pexpect_executor-4.2.0.tar.gz",
            "has_sig": false,
            "md5_digest": "18ffc8c0cfad29337c22d41eadf1ccc0",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*,!=3.7.*,>=3",
            "size": 86797,
            "upload_time": "2024-10-28T22:24:27",
            "upload_time_iso_8601": "2024-10-28T22:24:27.434287Z",
            "url": "https://files.pythonhosted.org/packages/92/55/03278150a1d8a78022aeed579b54570fe32a4e1b53d82cf97fd762ca310a/pexpect_executor-4.2.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-10-28 22:24:27",
    "github": false,
    "gitlab": true,
    "bitbucket": false,
    "codeberg": false,
    "gitlab_user": "RadianDevCore",
    "gitlab_project": "tools",
    "lcname": "pexpect-executor"
}
        
Elapsed time: 1.29261s