commandex


Namecommandex JSON
Version 0.2.3 PyPI version JSON
download
home_pagehttps://github.com/smartlegionlab/commandex/
SummaryA cross-platform library for creation, storage, management of commands and command packages. Execution of commands, parsing of files with command packages.
upload_time2024-06-16 09:18:46
maintainerNone
docs_urlNone
authorA.A. Suvorov
requires_python>=3.6
licenseBSD 3-Clause License
keywords commandex smartlegionlab commandman command executor
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # commandex

***

![GitHub top language](https://img.shields.io/github/languages/top/smartlegionlab/commandex)
[![PyPI - Downloads](https://img.shields.io/pypi/dm/commandex?label=pypi%20downloads)](https://pypi.org/project/commandex/)
[![GitHub release (latest by date)](https://img.shields.io/github/v/release/smartlegionlab/commandex)](https://github.com/smartlegionlab/commandex/)
[![GitHub](https://img.shields.io/github/license/smartlegionlab/commandex)](https://github.com/smartlegionlab/commandex/blob/master/LICENSE)
[![PyPI](https://img.shields.io/pypi/v/commandex)](https://pypi.org/project/commandex)
[![PyPI - Format](https://img.shields.io/pypi/format/commandex)](https://pypi.org/project/commandex)
[![GitHub Repo stars](https://img.shields.io/github/stars/smartlegionlab/commandex?style=social)](https://github.com/smartlegionlab/commandex/)
[![GitHub watchers](https://img.shields.io/github/watchers/smartlegionlab/commandex?style=social)](https://github.com/smartlegionlab/commandex/)
[![GitHub forks](https://img.shields.io/github/forks/smartlegionlab/commandex?style=social)](https://github.com/smartlegionlab/commandex/)

***

## Short Description:

___commandex___ -  A cross-platform library for creation, storage, management of commands and command packages. Execution of commands, parsing of files with command packages.

***

Author and developer: ___A.A. Suvorov___

[![smartlegiondev@gmail.com](https://img.shields.io/static/v1?label=email&message=smartlegiondev@gmail.com&color=blue)](mailto:smartlegiondev@gmail.com)

***

## Supported:

- Linux: All.
- Windows: 7/8/10.
- Termux (Android).

***

## What's new?

___commandex v0.2.3___

***

## Description:

A cross-platform library for creation, storage, management of commands and command packages. 
Execution of commands, parsing of files with command packages.

- Store the required commands under a given name in a simple file with a clear structure.
- Read named command packages from a file.
- Use only the required command packages from a file using filtering.
- Execute command packages cross-platform. 

### How it works?

1. Create a file with any name, with the extension * .cfg
2. Use # as a comment, line break for convenience or separation.
3. Use [package name] to specify the name of the command package.
4. After the name, write the commands that you decided to combine under this name, one per line.
5. To create the next batch of commands, use points 2, 3 again.
6. Between commands, you can insert blank lines or comments, see point 2.

Used to create utilities for working with commands (execution, launch, autorun, storage).

You can keep your commands in simple and understandable files, collect them in one place,
split into named categories (packages) and execute at any time:

The files must have the extension *.cfg, and have the correct structure:


### commands.cfg:

```ini
# Comments

[package name 1]
command 1
command 2
command N

[package name 2]
command 1
command 2
command N
```

***


## Help:

### Install and Use:

- `pip install commandex`

Available tools:

- Pack - storing commands.
- Command executors - command execution.
- Pack makers - create a list with objects of command packages.
- Parsers - parsers for files with command packages.
- Filters - filtering commands.
- Factories - Fabric for creating objects. 

Principle of operation:

- Reading command packages from a file.
- Filter packages if needed.
- We create a list of package objects for future use.
- We execute commands from each package.


### Simplest implementation:

```python
from commandex import Commander

commander = Commander()
# Reading command packages from a file.
pack_dict = commander.parsers.cfg_parser.parse('file.cfg')
# Filter packages if needed.
packs = commander.filters.pack_filter.filter_pack_dict(pack_dict, add_list=[], exc_list=[])
# We create a list of package objects for future use.
pack_list = commander.makers.pack_maker.make_pack_list(packs)

# We execute commands from each package.
for pack in pack_list:
    print(pack.name)
    for command in pack.commands:
        print(command)
        commander.executors.os.execute(command)

```

### Termux, Windows support:

Utilities created with use work "commandex", without problems in Termux, Windows.

For example: [commandman](https://github.com/smartlegionlab/commandman).

***

### Test coverage:

#### Run tests:
- `pip install pytest`
- `pytest -v`
  

#### __Test coverage 100%__

- `pip install pytest-coverage`
- `pytest --cov`

![commandex image](https://github.com/smartlegionlab/commandex/raw/master/data/images/commandex.png)


#### Report html:

- `pytest --cov --cov-report=html`

***

## Disclaimer of liability:

    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
    AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
    IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
    DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
    FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
    DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
    SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
    CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
    OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
    OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

***

## Copyright:
    --------------------------------------------------------
    Licensed under the terms of the BSD 3-Clause License
    (see LICENSE for details).
    Copyright © 2018-2024, A.A. Suvorov
    All rights reserved.
    --------------------------------------------------------
    https://github.com/smartlegionlab
    --------------------------------------------------------

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/smartlegionlab/commandex/",
    "name": "commandex",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": null,
    "keywords": "commandex, smartlegionlab, commandman, command executor",
    "author": "A.A. Suvorov",
    "author_email": "smartlegiondev@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/b9/f7/8e2be0a419dc10bfa78fdafd5be756668bf37d9123dd5898f83c027716be/commandex-0.2.3.tar.gz",
    "platform": null,
    "description": "# commandex\n\n***\n\n![GitHub top language](https://img.shields.io/github/languages/top/smartlegionlab/commandex)\n[![PyPI - Downloads](https://img.shields.io/pypi/dm/commandex?label=pypi%20downloads)](https://pypi.org/project/commandex/)\n[![GitHub release (latest by date)](https://img.shields.io/github/v/release/smartlegionlab/commandex)](https://github.com/smartlegionlab/commandex/)\n[![GitHub](https://img.shields.io/github/license/smartlegionlab/commandex)](https://github.com/smartlegionlab/commandex/blob/master/LICENSE)\n[![PyPI](https://img.shields.io/pypi/v/commandex)](https://pypi.org/project/commandex)\n[![PyPI - Format](https://img.shields.io/pypi/format/commandex)](https://pypi.org/project/commandex)\n[![GitHub Repo stars](https://img.shields.io/github/stars/smartlegionlab/commandex?style=social)](https://github.com/smartlegionlab/commandex/)\n[![GitHub watchers](https://img.shields.io/github/watchers/smartlegionlab/commandex?style=social)](https://github.com/smartlegionlab/commandex/)\n[![GitHub forks](https://img.shields.io/github/forks/smartlegionlab/commandex?style=social)](https://github.com/smartlegionlab/commandex/)\n\n***\n\n## Short Description:\n\n___commandex___ -  A cross-platform library for creation, storage, management of commands and command packages. Execution of commands, parsing of files with command packages.\n\n***\n\nAuthor and developer: ___A.A. Suvorov___\n\n[![smartlegiondev@gmail.com](https://img.shields.io/static/v1?label=email&message=smartlegiondev@gmail.com&color=blue)](mailto:smartlegiondev@gmail.com)\n\n***\n\n## Supported:\n\n- Linux: All.\n- Windows: 7/8/10.\n- Termux (Android).\n\n***\n\n## What's new?\n\n___commandex v0.2.3___\n\n***\n\n## Description:\n\nA cross-platform library for creation, storage, management of commands and command packages. \nExecution of commands, parsing of files with command packages.\n\n- Store the required commands under a given name in a simple file with a clear structure.\n- Read named command packages from a file.\n- Use only the required command packages from a file using filtering.\n- Execute command packages cross-platform. \n\n### How it works?\n\n1. Create a file with any name, with the extension * .cfg\n2. Use # as a comment, line break for convenience or separation.\n3. Use [package name] to specify the name of the command package.\n4. After the name, write the commands that you decided to combine under this name, one per line.\n5. To create the next batch of commands, use points 2, 3 again.\n6. Between commands, you can insert blank lines or comments, see point 2.\n\nUsed to create utilities for working with commands (execution, launch, autorun, storage).\n\nYou can keep your commands in simple and understandable files, collect them in one place,\nsplit into named categories (packages) and execute at any time:\n\nThe files must have the extension *.cfg, and have the correct structure:\n\n\n### commands.cfg:\n\n```ini\n# Comments\n\n[package name 1]\ncommand 1\ncommand 2\ncommand N\n\n[package name 2]\ncommand 1\ncommand 2\ncommand N\n```\n\n***\n\n\n## Help:\n\n### Install and Use:\n\n- `pip install commandex`\n\nAvailable tools:\n\n- Pack - storing commands.\n- Command executors - command execution.\n- Pack makers - create a list with objects of command packages.\n- Parsers - parsers for files with command packages.\n- Filters - filtering commands.\n- Factories - Fabric for creating objects. \n\nPrinciple of operation:\n\n- Reading command packages from a file.\n- Filter packages if needed.\n- We create a list of package objects for future use.\n- We execute commands from each package.\n\n\n### Simplest implementation:\n\n```python\nfrom commandex import Commander\n\ncommander = Commander()\n# Reading command packages from a file.\npack_dict = commander.parsers.cfg_parser.parse('file.cfg')\n# Filter packages if needed.\npacks = commander.filters.pack_filter.filter_pack_dict(pack_dict, add_list=[], exc_list=[])\n# We create a list of package objects for future use.\npack_list = commander.makers.pack_maker.make_pack_list(packs)\n\n# We execute commands from each package.\nfor pack in pack_list:\n    print(pack.name)\n    for command in pack.commands:\n        print(command)\n        commander.executors.os.execute(command)\n\n```\n\n### Termux, Windows support:\n\nUtilities created with use work \"commandex\", without problems in Termux, Windows.\n\nFor example: [commandman](https://github.com/smartlegionlab/commandman).\n\n***\n\n### Test coverage:\n\n#### Run tests:\n- `pip install pytest`\n- `pytest -v`\n  \n\n#### __Test coverage 100%__\n\n- `pip install pytest-coverage`\n- `pytest --cov`\n\n![commandex image](https://github.com/smartlegionlab/commandex/raw/master/data/images/commandex.png)\n\n\n#### Report html:\n\n- `pytest --cov --cov-report=html`\n\n***\n\n## Disclaimer of liability:\n\n    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\n    AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n    IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\n    DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE\n    FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n    DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\n    SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n    CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,\n    OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n    OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n***\n\n## Copyright:\n    --------------------------------------------------------\n    Licensed under the terms of the BSD 3-Clause License\n    (see LICENSE for details).\n    Copyright \u00a9 2018-2024, A.A. Suvorov\n    All rights reserved.\n    --------------------------------------------------------\n    https://github.com/smartlegionlab\n    --------------------------------------------------------\n",
    "bugtrack_url": null,
    "license": "BSD 3-Clause License",
    "summary": "A cross-platform library for creation, storage, management of commands and command packages. Execution of commands, parsing of files with command packages.",
    "version": "0.2.3",
    "project_urls": {
        "Documentation": "https://github.com/smartlegionlab/commandex/blob/master/README.md",
        "Homepage": "https://github.com/smartlegionlab/commandex/",
        "Release notes": "https://github.com/smartlegionlab/commandex/releases"
    },
    "split_keywords": [
        "commandex",
        " smartlegionlab",
        " commandman",
        " command executor"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "6a15d25f8b27c3b6a916d6d7c8062e4466cdfd07d2c6d6b55f1bb033182309d7",
                "md5": "9541b5bf9020ea2996778dd3ececc060",
                "sha256": "cb1a2252f3c9a0faae8c024493e7fbfd10bdb54f46fb188e8c21fa4e36cfaa19"
            },
            "downloads": -1,
            "filename": "commandex-0.2.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "9541b5bf9020ea2996778dd3ececc060",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 8791,
            "upload_time": "2024-06-16T09:18:43",
            "upload_time_iso_8601": "2024-06-16T09:18:43.605805Z",
            "url": "https://files.pythonhosted.org/packages/6a/15/d25f8b27c3b6a916d6d7c8062e4466cdfd07d2c6d6b55f1bb033182309d7/commandex-0.2.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b9f78e2be0a419dc10bfa78fdafd5be756668bf37d9123dd5898f83c027716be",
                "md5": "47214760edf1222e9490d7be0e44664b",
                "sha256": "221a4450db9d649f111250c15965a9507a72b61197f8458a0cb8b7842a677582"
            },
            "downloads": -1,
            "filename": "commandex-0.2.3.tar.gz",
            "has_sig": false,
            "md5_digest": "47214760edf1222e9490d7be0e44664b",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 8375,
            "upload_time": "2024-06-16T09:18:46",
            "upload_time_iso_8601": "2024-06-16T09:18:46.059664Z",
            "url": "https://files.pythonhosted.org/packages/b9/f7/8e2be0a419dc10bfa78fdafd5be756668bf37d9123dd5898f83c027716be/commandex-0.2.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-06-16 09:18:46",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "smartlegionlab",
    "github_project": "commandex",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [],
    "tox": true,
    "lcname": "commandex"
}
        
Elapsed time: 0.25459s