# manrs

A command-line viewer for documentation generated by `rustdoc`. Modernized fork of [rusty-man](https://git.sr.ht/~ireas/rusty-man).

## Example Usage

Look up any item by name (manrs finds your project's `target/doc` automatically):

```
$ manrs std::collections::HashMap
$ manrs serde::Serialize
$ manrs anyhow::Error
```

Partial names work too:

```
$ manrs HashMap
```

**No keyword? Get an interactive crate picker.** Run `manrs` with no arguments inside any Cargo project — it will run `cargo doc` if needed, then show you a numbered list of available crates:

```
$ manrs
Documentation not found. Running cargo doc...
Select a crate to browse:

[ 0 ] anyhow
[ 1 ] manrs
[ 2 ] scraper
[ 3 ] serde

> 1
```

If there are multiple matches for a keyword, manrs prompts you to pick one:

```
$ manrs u8
Found multiple matches for u8 – select one of:

[ 0 ] core::u8: The 8-bit unsigned integer type.
[ 1 ] std::u8: The 8-bit unsigned integer type.

> 1
```

To read docs from a non-default location use `-s`/`--source`:

```
$ manrs --source path/to/target/doc io::Error
```

For all options:

```
$ manrs --help
```

## Viewers

Select a viewer with `--viewer`:

- `plain` — plain text output, no formatting. Default for non-interactive use (pipes, scripts).
- `rich` — formatted output with ANSI colors and syntax highlighting. Default for interactive terminals.
- `tui` — interactive terminal UI with keyboard navigation.

```
$ manrs --viewer tui std::vec::Vec
```

## Installation

### From source

```
$ git clone https://github.com/Feeco-Li/manrs
$ cd manrs
$ cargo install --path .
```

### System docs

To browse standard library docs without running `cargo doc` first, install the Rust documentation component:

```
$ rustup component add rust-docs
$ manrs std::fs::File
```

## Editor Integration

### Neovim / Vim

Set manrs as the keyword lookup program for Rust files:

```vim
autocmd FileType rust setlocal keywordprg=manrs
```

Then press `K` over any identifier to open its documentation.

## License

MIT. Originally based on [rusty-man](https://git.sr.ht/~ireas/rusty-man) by Robin Krahl.
