Reading installed crate docs in the terminal?

Is there a tool to browse documentation for crates from the command line interactively? I have been searching and the closest I see is a suggestion to navigate from a symbol in the IDE. Other solutions open up documentation in the browser (like cargo doc --open).

I am looking for something like Ruby's RI (which I'm not sure is still being maintained). It has an interactive mode that allows you to call up documentation for various elements/gems.

As I prefer to work in the terminal, it would be nice not to have to switch to the browser, which breaks the flow and forces you to take your hands off the keyboard.

1 Like

rusty-man?

Disclosure: I'm the author. The tool is incomplete, but aims to provide the ability of viewing doc and much more.

1 Like

Hi, thanks for the reply! I installed and tried out your tool earlier, but I couldn't understand how to make it work. I navigated around and searched packages, but could not find out how to get to actual documentation. (I did look at the help offered with F1).

You can follow these steps:

  • launch the app
  • search local crates by typing characters
  • use Tab to switch the cursor between on database doc items and registry pkg items
  • use mouse double click or cursor up/down to select one pkg from Registry panel
  • Up/Down/PageUp/PageDown are supported to move the cursor in other panels
  • then you'll see version and feature selection window: mouse and cursor are both supported:
    • double click (or press Enter) on a feature to toggle it
    • click a version (or use Tab to version selection)
    • by default, the latest pkg with features from manifest file is selected
    • press Space to start compiling the doc and cache it into database, this will close the selection window and back to database panel, so wait for the doc status from HoldOn to Cached
  • load the Cached docs on database panel by pressing Enter (or double click), then the documentation page is opened
    • use Ctrl-w to switch between Database-Registry window and the Page window
    • multiple docs can be opened: use Delete to unload one
  • use up/down/j/k key (or single click) to select an item, the documentation is auto updated in the middle of the page
    • TOC on the right-top is clickable, so click to jump to a heading
    • by default, the module-item tree is 0-level collapsed, meaning nested modules are folded, so
      • use Enter or double click to expand/toggle one module
      • use / or 0 or 1 to expand all / 0-level / 1st-level modules
    • items contains inner items and definition, all items should have them, but for now only functions/traits/structs are supported
      • click on the right-bottom list on Page, or use left/right/h/l key on Page to trigger one action from there
  • the center panel is the documentation where mouse scrolling/PageUp/PageDown is supported (you should click and focus on it first to perform scrolling)
  • Ctrl-q to quit

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.