59 lines
1.0 KiB
Markdown
59 lines
1.0 KiB
Markdown
# cmdparse
|
|
|
|
A CLI tool that parses unstructured CLI command output into structured formats.
|
|
|
|
## Features
|
|
|
|
- Auto-detect output format from CLI commands
|
|
- Support for multiple output formats: JSON, YAML, CSV, raw
|
|
- Extract specific fields using dot notation
|
|
- Custom configuration support
|
|
- Built-in patterns for common CLI outputs
|
|
|
|
## Installation
|
|
|
|
```bash
|
|
pip install cmdparse
|
|
```
|
|
|
|
## Usage
|
|
|
|
```bash
|
|
# Parse CLI output with auto-detection
|
|
cmdparse < input.txt
|
|
|
|
# Specify output format
|
|
cmdparse -o yaml < input.txt
|
|
|
|
# Extract specific fields
|
|
cmdparse -e field1 -e field2 < input.txt
|
|
|
|
# Use custom config
|
|
cmdparse -c custom.yaml < input.txt
|
|
```
|
|
|
|
## Supported Formats
|
|
|
|
- Tabular output (with/without borders)
|
|
- Key-value pairs (colon or equals delimiter)
|
|
- Delimited text (CSV, TSV, semicolon-separated)
|
|
- JSON-like output
|
|
- Raw/unstructured text
|
|
|
|
## Configuration
|
|
|
|
Create a `.cmdparse.yaml` file in your home directory or project root:
|
|
|
|
```yaml
|
|
parsers:
|
|
- name: custom
|
|
pattern: your_regex
|
|
fields:
|
|
- field1
|
|
- field2
|
|
```
|
|
|
|
## License
|
|
|
|
MIT
|