Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tybruno/commands_parser
https://github.com/tybruno/commands_parser
Last synced: 16 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/tybruno/commands_parser
- Owner: tybruno
- License: mit
- Created: 2021-08-06T17:56:39.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2021-08-06T21:20:59.000Z (over 3 years ago)
- Last Synced: 2024-10-18T14:29:38.289Z (2 months ago)
- Language: Python
- Size: 4.88 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# commands_parser
Made the ability to parse a string of commands easier.
#### Key Features:
* **Easy**: Designed with simplicity in mind. Uses modern design principle making the code DRY and Extensible.
* **Great Developer Experience**: Being fully typed makes it great for editor support.
* **There is More!!!**:
* [host_reader](https://github.com/tybruno/hosts_reader): retreive a list of host from a file or string.
* [commands_reader](https://github.com/tybruno/commands_reader): retreive a list of commands from a file or string.
* [parser](https://github.com/tybruno/parsers): Generic Parsers and Abstract classes. This project extends parsers.
## Installation
`pip install "git+https://github.com/tybruno/commands_parser.git#egg=commands_parser`
## Usage
### Example 1
```python
from commands_parser import CommandsParser
commands_str = "show cdp nei, show run | inc boot"parse_commands = CommandsParser()
commands = parse_commands(commands_str)
print(list(commands)) # ['show cdp nei', 'show run | inc boot']
```
### Example 2```python
from commands_parser import CommandsParser
commands_str = """show cdp nei
show run | inc boot
"""parse_commands = CommandsParser()
commands = parse_commands(commands_str)
print(tuple(commands)) # ('show cdp nei', 'show run | inc boot')
```