mirror of
https://github.com/voson-wang/toon.git
synced 2026-01-29 15:24:10 +08:00
feat(cli): add --stats flag to show token savings (#51)
* feat(cli): add --stats flag to show token efficiency - Add --stats boolean flag to display token count comparison - Calculate approximate tokens using char length / 4 heuristic - Show JSON vs TOON token counts with savings percentage - Opt-in feature, default behavior unchanged * feat: use tokenx for more accurate estimates --------- Co-authored-by: Johann Schopplich <mail@johannschopplich.com>
This commit is contained in:
@@ -499,11 +499,15 @@ toon input.json
|
||||
| `--delimiter <char>` | Array delimiter: `,` (comma), `\t` (tab), `\|` (pipe) |
|
||||
| `--indent <number>` | Indentation size (default: `2`) |
|
||||
| `--length-marker` | Add `#` prefix to array lengths (e.g., `items[#3]`) |
|
||||
| `--stats` | Show token count estimates and savings (encode only) |
|
||||
| `--no-strict` | Disable strict validation when decoding |
|
||||
|
||||
### Examples
|
||||
|
||||
```bash
|
||||
# Show token savings when encoding
|
||||
toon data.json --stats -o output.toon
|
||||
|
||||
# Tab-separated output (often more token-efficient)
|
||||
toon data.json --delimiter "\t" -o output.toon
|
||||
|
||||
|
||||
Reference in New Issue
Block a user