Refactor CLI and consolidate ZON conversion functionality

- Move `zon2json` command from `main.py` to `__main__.py`
- Create shared `convert_zon_to_json` function for consistent JSON conversion
- Update pyproject.toml to point `zon2json` script to new location
- Update README with `uv run` prefix for CLI commands
- Expose key functions in `__init__.py` for easier importing
- Remove redundant `main.py` file
This commit is contained in:
2025-03-07 18:18:26 +08:00
parent 765c98502c
commit 09cbad23d6
5 changed files with 97 additions and 111 deletions

View File

@ -62,7 +62,7 @@ The package provides a command-line interface with the following commands:
Download and extract dependencies from a ZON file:
```bash
zig-fetch download examples/test.zon
uv run zig-fetch download examples/test.zon
```
This will download all dependencies specified in the ZON file to `~/.cache/zig/p` and extract them to directories named after their hash values.
@ -72,13 +72,7 @@ This will download all dependencies specified in the ZON file to `~/.cache/zig/p
Convert a ZON file to JSON:
```bash
zig-fetch convert examples/test.zon
```
Or use the dedicated command:
```bash
zon2json examples/test.zon
uv run zig-fetch convert examples/test.zon
```
Options: