Skip to content

Commit e0438cf

Browse files
committed
.
1 parent 67c0745 commit e0438cf

1 file changed

Lines changed: 44 additions & 18 deletions

File tree

README.md

Lines changed: 44 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,50 @@ From source:
8484
- INPUT (optional, repeatable): file path(s). If omitted, reads from stdin. Multiple input files are supported.
8585
- Prints the preview to stdout. On parse errors, exits non‑zero and prints an error to stderr.
8686

87+
### Quick examples
88+
89+
Peek a JSON stream from stdin:
90+
91+
```bash
92+
curl -sS 'https://pokeapi.co/api/v2/pokemon?limit=151' | hson -c 800
93+
```
94+
95+
Preview many files with a single total budget:
96+
97+
```bash
98+
hson -c 200 -C 1200 logs/*.json
99+
```
100+
101+
Machine-readable preview (strict JSON):
102+
103+
```bash
104+
hson -c 200 -f json -t strict data.json
105+
```
106+
107+
YAML with detailed comments:
108+
109+
```bash
110+
hson -c 400 -f yaml -t detailed config.yaml
111+
```
112+
113+
Keep matches visible (grep-like) while still summarizing structure:
114+
115+
```bash
116+
hson --grep 'error|warning' -c 200 -C 1200 logs/*.json
117+
```
118+
119+
Tree-like view with inline previews:
120+
121+
```bash
122+
hson --tree --glob 'src/**/*' -c 160 -C 1200
123+
```
124+
125+
Source code outline (keeps lines intact; omits blocks under tight budgets):
126+
127+
```bash
128+
hson -n 20 src/main.py
129+
```
130+
87131
Common flags:
88132

89133
- `-c, --bytes <BYTES>`: per‑file output budget (bytes). For multiple inputs, default total budget is `<BYTES> * number_of_inputs`.
@@ -176,24 +220,6 @@ Use `--tree` to render filesets as a directory tree (like `tree`) with inline st
176220
- Outputs stay non-empty unless you explicitly set a per-file cap of zero; in that case that slot can be suppressed entirely (matching the CLI’s `-n 0` semantics). Extremely tight nonzero caps that cannot fit even an omission marker can also yield empty output; filesets/tree may show only omission counts in that scenario.
177221
- When only lines are specified, no implicit byte cap applies. When neither lines nor chars are specified, a 500‑byte default applies.
178222

179-
Quick one‑liners:
180-
181-
- Peek a big JSON stream (keeps structure):
182-
183-
zstdcat huge.json.zst | hson -c 800 -f json -t default
184-
185-
- Many files with a fixed overall size:
186-
187-
hson -C 1200 -f json -t strict logs/*.json
188-
189-
- Glance at a file, JavaScript‑style comments for omissions:
190-
191-
hson -c 400 -f json -t detailed data.json
192-
193-
- YAML with detailed comments:
194-
195-
hson -c 400 -f yaml -t detailed config.yaml
196-
197223
### Text mode
198224

199225
- Single file (auto):

0 commit comments

Comments
 (0)