upvote
When I have this problem, I catenate two outputs:

    man curl |grep -e -L
    man curl
This way, I have all the matches at hand. When I pick the one I need, I select the line and search for it, finding the next occurrence in the full man-page.

Checking sub-command section is trivial as well. Because the editor remembers the exact location of the cursor, you can always go back to it after scrolling up and down however you feel like.

For this scenario to work nicely, you have to have run the commands from a text editor. I use Acme [1], it’s optimized for this style of work and doesn’t shy away mice. (I think that the traditional TUI cannot be as smooth.)

So, to hell with AI.

[1]: https://p9f.org/sys/doc/acme/acme.html

reply

  man -O tag=L ls
would search for the L tag in the ls(1) man page, or there's

  man -akO tag Ic=ulimit
to find whatever the ulimit thing is or for an even more general search a small wrapper along the lines of

  #!/bin/sh
  man -akO tag="$1" any="$1"
may help, unless you are not on OpenBSD, in which case you may wish for the droolsauce and energy waste that is AI because the documentation on your OS is probably some sort of evolving train wreck (man pages -> gun info -> README from 2003 -> web pages, increasingly bloated and behind the iron curtain of javascript -> ??? -> Singularity! Three hails for our Saint Kurzweil!!). Back when I supported Linux I might just run strace on the process because who knew if there was documentation (maybe?) or if it was accurate (sometimes?) and

  function info { /usr/bin/info "$@" 2>/dev/null | $PAGER; }
is at least a ksh function for making info somewhat less terrible.
reply
After a while you learn to be specific ' -a' (with space) or '-a,', but this requires that you know what you're looking for. Also n/N is easier to jump between matches than /<Enter>, one less keypress.

Another useful trick is filtering with &, &/-a will narrow it down, but you won't know about the sub-commands if there are many matches. I just tried &/hidden on rg and fd and it takes me straight to `-., --hidden` for rg and `-H, --hidden` for fd. And &/case shows all options related to case-sensitivity with the descriptions. Once you get the intuition for it it's not that bad.

Manuals are not perfect but I don't think I would want an AI. I'm frustrated enough when I don't find a flag the LLM insists is supposed to be there and it gaslights me even though I'm telling the stupid thing I have the manual open.

reply