1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
# just a fucking manual
`jafm` searches through **all your man pages** for a symbol, figures out which
page actually documents it, and opens it for you.
i find it genuinely insane how fucking illiterate the default `man` command can be. i was making a simple http server in c and wanted the man page for `sockaddr_in`. every single time i tried `man sockaddr_in` it went: `No manual entry for sockaddr_in`. and this *should* work, because it works on linux. but, as it so happens, i am not on linux all the time. the docs for `sockaddr_in` were right there, inside another page (`inet`). so i had to somehow guess which random man page contained the thing i was looking for. `jafm` fixes that. it reads every page, ranks the hits so the real one is on top, shows you a picker with a live preview, and opens whatever you choose.
```sh
$ jafm sockaddr
```
that's it. i find it genuinely unacceptable that this is not an already solved issue. watch the demo [here](https://www.youtube.com/watch?v=ab9yrSoBfeY).
## what you get
`jafm` searches every page in your `manpath`, in parallel, in a fraction of a second. it **ranks by relevance** so the page that actually documents your symbol floats to the top, tells you *what* it found and its **kind** (`sockaddr_in (struct)`), and gives you an **interactive picker** with a live `man` **preview** on the side and the match highlighted in the page.
## usage
```text
$ jafm --help
jafm 0.1.0 - just a fucking manual
greps your whole manpath for a symbol and opens the page that actually
documents it, because `man <symbol>` gives up way too easily.
usage: jafm [-1] [-l] [-e] [-t type] [-j threads] <symbol>
jafm [-v | -h]
options:
-1, --first open the best match without asking
-l, --list just print what it found, open nothing
-e, --exact match the symbol as a whole word only
-t, --type KIND only show matches where the symbol is a KIND
(struct, union, enum, typedef, function)
-j, --jobs N scan with N worker threads (default 8)
-v, --version print version and bail
-h, --help print this and bail
by hachem <im@hachem.wtf>
```
in the picker: `↑`/`↓` or `k`/`j` to move, `Enter` to open, `q` to bail. pipe
its stdin instead of a tty and it drops to a numbered prompt.
```sh
$ jafm sockaddr # pick from the list
$ jafm -1 getentropy # open the best match straight away
$ jafm -t struct -l sockaddr # every struct named *sockaddr*, printed
$ jafm -e -1 inet # whole word, open the winner
```
## build
needs a c compiler, `zlib`, and `pthreads`. nothing else.
```sh
$ sudo make install # -> /usr/local/bin + man page
$ make install PREFIX=~/.local # or somewhere without sudo
```
it really is one file, so if you don't want the makefile:
```sh
$ cc -O2 jafm.c -o jafm -lz -lpthread
```
## license
`jafm` is licensed under the mit license. see [license](LICENSE) for more.
|