fix: resolve CI/CD test failures and linting issues
This commit is contained in:
153
README.md
153
README.md
@@ -1,6 +1,6 @@
|
|||||||
# ConfigConvert CLI
|
# ConfigConvert CLI
|
||||||
|
|
||||||
A powerful CLI tool for bidirectional conversion between JSON, YAML, TOML, and ENV config formats with smart type inference, validation, flatten/unflatten operations, schema generation, and automatic shell completion support.
|
A powerful CLI tool for bidirectional conversion between JSON, YAML, TOML, and ENV config formats.
|
||||||
|
|
||||||
## Features
|
## Features
|
||||||
|
|
||||||
@@ -11,25 +11,14 @@ A powerful CLI tool for bidirectional conversion between JSON, YAML, TOML, and E
|
|||||||
- **Schema Generation**: Generate JSON Schema from parsed configurations
|
- **Schema Generation**: Generate JSON Schema from parsed configurations
|
||||||
- **Shell Completion**: Built-in support for bash, zsh, and fish completions
|
- **Shell Completion**: Built-in support for bash, zsh, and fish completions
|
||||||
- **Offline Operation**: Runs entirely offline with minimal dependencies
|
- **Offline Operation**: Runs entirely offline with minimal dependencies
|
||||||
- **Rich Output**: Beautiful terminal output using Rich library
|
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
### From PyPI
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
pip install config-convert-cli
|
pip install config-convert-cli
|
||||||
```
|
```
|
||||||
|
|
||||||
### From Source
|
## Usage
|
||||||
|
|
||||||
```bash
|
|
||||||
git clone https://7000pct.gitea.bloupla.net/7000pctAUTO/config-convert-cli.git
|
|
||||||
cd config-convert-cli
|
|
||||||
pip install -e ".[dev]"
|
|
||||||
```
|
|
||||||
|
|
||||||
## Quick Start
|
|
||||||
|
|
||||||
### Convert between formats
|
### Convert between formats
|
||||||
|
|
||||||
@@ -37,77 +26,55 @@ pip install -e ".[dev]"
|
|||||||
# Convert JSON to YAML
|
# Convert JSON to YAML
|
||||||
config-convert convert input.json --to yaml -o output.yaml
|
config-convert convert input.json --to yaml -o output.yaml
|
||||||
|
|
||||||
# Convert YAML to JSON with custom indentation
|
# Convert YAML to JSON
|
||||||
config-convert convert config.yaml --from yaml --to json --indent 4
|
config-convert convert config.yaml --from yaml --to json
|
||||||
|
|
||||||
# Convert ENV to JSON
|
# Convert ENV to JSON
|
||||||
config-convert convert .env --from env --to json
|
config-convert convert .env --from env --to json
|
||||||
|
|
||||||
# Read from stdin
|
|
||||||
cat config.json | config-convert convert --stdin --from json --to yaml
|
|
||||||
|
|
||||||
# Pretty print output
|
# Pretty print output
|
||||||
config-convert convert config.json --to yaml --indent 2
|
config-convert convert config.json --to yaml --pretty
|
||||||
```
|
```
|
||||||
|
|
||||||
### Validate syntax
|
### Validate syntax
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Validate a config file
|
config-validate config.yaml
|
||||||
config-convert validate config.yaml
|
|
||||||
|
|
||||||
# Validate from stdin
|
|
||||||
echo '{"name": "test"}' | config-convert validate --stdin --format json
|
|
||||||
```
|
```
|
||||||
|
|
||||||
### Flatten nested structures
|
### Flatten nested structures
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Flatten nested JSON to ENV format
|
|
||||||
config-convert flatten config.json --output flat.env
|
config-convert flatten config.json --output flat.env
|
||||||
|
|
||||||
# Flatten to another structured format
|
|
||||||
config-convert flatten config.json --format yaml
|
|
||||||
```
|
```
|
||||||
|
|
||||||
### Unflatten to nested structures
|
### Unflatten to nested structures
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Unflatten ENV to JSON
|
config-convert unflatten flat.env --output nested.yaml
|
||||||
config-convert unflatten flat.env --format json --output nested.json
|
|
||||||
```
|
```
|
||||||
|
|
||||||
### Generate JSON Schema
|
### Generate JSON Schema
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Generate schema from config
|
|
||||||
config-convert schema config.json -o schema.json
|
config-convert schema config.json -o schema.json
|
||||||
|
|
||||||
# Generate and display schema
|
|
||||||
config-convert schema config.json
|
|
||||||
```
|
|
||||||
|
|
||||||
### List supported formats
|
|
||||||
|
|
||||||
```bash
|
|
||||||
config-convert formats
|
|
||||||
```
|
```
|
||||||
|
|
||||||
## Supported Formats
|
## Supported Formats
|
||||||
|
|
||||||
| Format | Extensions | Read | Write |
|
| Format | Extension | Read | Write |
|
||||||
|--------|------------|------|-------|
|
|--------|-----------|------|-------|
|
||||||
| JSON | .json | Yes | Yes |
|
| JSON | .json | ✓ | ✓ |
|
||||||
| YAML | .yaml, .yml| Yes | Yes |
|
| YAML | .yaml | ✓ | ✓ |
|
||||||
| TOML | .toml | Yes | Yes |
|
| TOML | .toml | ✓ | ✓ |
|
||||||
| ENV | .env | Yes | Yes |
|
| ENV | .env | ✓ | ✓ |
|
||||||
|
|
||||||
## Shell Completion
|
## Shell Completion
|
||||||
|
|
||||||
### Bash
|
### Bash
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Install completions for current user
|
# Install completions
|
||||||
config-convert --install-completion bash
|
config-convert --install-completion bash
|
||||||
|
|
||||||
# Or source directly
|
# Or source directly
|
||||||
@@ -126,95 +93,17 @@ config-convert --install-completion zsh
|
|||||||
config-convert --install-completion fish
|
config-convert --install-completion fish
|
||||||
```
|
```
|
||||||
|
|
||||||
## Configuration
|
|
||||||
|
|
||||||
### Environment Variables
|
|
||||||
|
|
||||||
| Variable | Description | Default |
|
|
||||||
|----------|-------------|---------|
|
|
||||||
| CONFIG_CONVERT_THEME | Color theme for Rich output | default |
|
|
||||||
| CONFIG_CONVERT_INDENT | Default indentation for output | 2 |
|
|
||||||
|
|
||||||
## Exit Codes
|
## Exit Codes
|
||||||
|
|
||||||
| Code | Description |
|
| Code | Description |
|
||||||
|------|-------------|
|
|------|-------------|
|
||||||
| 0 | Success |
|
| 0 | Success |
|
||||||
| 1 | General error |
|
| 1 | General error |
|
||||||
| 2 | Invalid arguments |
|
| 2 | Invalid arguments |
|
||||||
| 3 | File not found |
|
| 3 | File not found |
|
||||||
| 4 | Syntax error in input |
|
| 4 | Syntax error in input |
|
||||||
| 5 | Conversion error |
|
| 5 | Conversion error |
|
||||||
|
|
||||||
## Development
|
|
||||||
|
|
||||||
### Setup
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Create virtual environment
|
|
||||||
python -m venv venv
|
|
||||||
source venv/bin/activate # On Windows: venv\Scripts\activate
|
|
||||||
|
|
||||||
# Install dependencies
|
|
||||||
pip install -e ".[dev]"
|
|
||||||
|
|
||||||
# Run tests
|
|
||||||
pytest tests/ -v
|
|
||||||
|
|
||||||
# Run with coverage
|
|
||||||
pytest --cov=config_convert --cov-report=term-missing
|
|
||||||
|
|
||||||
# Run linting
|
|
||||||
ruff check .
|
|
||||||
```
|
|
||||||
|
|
||||||
### Project Structure
|
|
||||||
|
|
||||||
```
|
|
||||||
config-convert-cli/
|
|
||||||
├── config_convert/
|
|
||||||
│ ├── __init__.py
|
|
||||||
│ ├── cli.py
|
|
||||||
│ ├── converters/
|
|
||||||
│ │ ├── __init__.py
|
|
||||||
│ │ ├── base.py
|
|
||||||
│ │ ├── json_converter.py
|
|
||||||
│ │ ├── yaml_converter.py
|
|
||||||
│ │ ├── toml_converter.py
|
|
||||||
│ │ └── env_converter.py
|
|
||||||
│ ├── utils/
|
|
||||||
│ │ ├── __init__.py
|
|
||||||
│ │ ├── type_inference.py
|
|
||||||
│ │ ├── flatten.py
|
|
||||||
│ │ └── schema.py
|
|
||||||
│ └── validators/
|
|
||||||
│ ├── __init__.py
|
|
||||||
│ └── syntax.py
|
|
||||||
├── tests/
|
|
||||||
│ ├── __init__.py
|
|
||||||
│ ├── conftest.py
|
|
||||||
│ ├── test_cli.py
|
|
||||||
│ ├── test_converters/
|
|
||||||
│ ├── test_type_inference.py
|
|
||||||
│ ├── test_flatten.py
|
|
||||||
│ ├── test_schema.py
|
|
||||||
│ ├── test_validators.py
|
|
||||||
│ └── fixtures/
|
|
||||||
├── scripts/
|
|
||||||
│ └── completions.py
|
|
||||||
├── pyproject.toml
|
|
||||||
├── requirements.txt
|
|
||||||
└── README.md
|
|
||||||
```
|
|
||||||
|
|
||||||
## Contributing
|
|
||||||
|
|
||||||
1. Fork the repository
|
|
||||||
2. Create a feature branch
|
|
||||||
3. Make your changes
|
|
||||||
4. Run tests and linting
|
|
||||||
5. Submit a pull request
|
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
MIT License - see LICENSE file for details.
|
MIT
|
||||||
|
|||||||
Reference in New Issue
Block a user