zig langref cli
nate.tngl.io/zigman
2.3 kB
82 lines
1# zigman
2
3read the [zig language reference](https://ziglang.org/documentation/master/) in your
4terminal — for humans who don't want a browser tab, and for agents that can't render one.
5it fetches the reference once, caches it, and prints any section as clean markdown.
6
7source: [tangled.org/zzstoatzz.io/zigman](https://tangled.org/zzstoatzz.io/zigman) · MIT
8
9## install
10
11```
12curl -fsSL https://nate.tngl.io/zigman/install.sh | sh
13```
14
15macos and linux, aarch64 and x86_64. installs to `$ZIGMAN_INSTALL` or `~/.local/bin`.
16
17## use
18
19type any part of a section's name. a unique match opens it; an ambiguous one lists the
20candidates.
21
22```
23zigman comptime # opens the comptime section
24zigman error # several match, so it lists them
25zigman -o comptime # open it in your browser instead
26zigman -l # the whole table of contents
27zigman -V 0.15.1 comptime # read a specific langref version
28```
29
30for everyday workflows, composition, and using zigman from an AI agent, see the
31[practical guide](https://nate.tngl.io/zigman/guide.html).
32
33<details>
34<summary>build from source</summary>
35
36requires zig 0.16+.
37
38```
39git clone https://tangled.org/zzstoatzz.io/zigman
40cd zigman
41zig build -Doptimize=ReleaseSafe
42```
43
44the parser and renderer are a reusable zig module (`src/root.zig`, exported as `zigman`).
45`zig build test` runs the unit tests.
46
47</details>
48
49<details>
50<summary>shell completion</summary>
51
52add one line to your shell's startup file:
53
54```
55# ~/.zshrc (after compinit)
56eval "$(zigman --completions zsh)"
57
58# ~/.bashrc
59eval "$(zigman --completions bash)"
60
61# ~/.config/fish/config.fish
62zigman --completions fish | source
63```
64
65</details>
66
67<details>
68<summary>options & paging</summary>
69
70```
71-l, --list list section names instead of rendering
72-o, --open open the section in your browser ($BROWSER, else the OS opener)
73-V, --version <ver> langref version to read (default: master)
74-r, --refresh bypass the cache and refetch
75 --no-pager don't page output on a terminal
76-h, --help show help
77```
78
79output is plain markdown. on a terminal it pages through `$PAGER` (default `less -FRX`);
80piped, it stays raw — so `zigman comptime | glow -` and `zigman -l | fzf` both work.
81
82</details>