Command line rust docs?

Is there a command line rust doc? Like python -m pydoc re or perldoc re or man pcre
Pulling up a web browser just isn't close enough to the speed-of-thought.

I have created my first app and I found that I was continually frustrated by not being able to get a quick, short(ish), answer.

e.g.

  • ruston regex
  • ruston regex::Regex
  • ruston clap
  • ruston fs
1 Like
cargo doc --package regex --open

That one, you have to open the regex docs like above and scroll / click a little.

Do you mean like the man command?

I feel the same, so I wrote one: GitHub - zjp-CN/term-rustdoc: [WIP] A TUI for Rust docs that aims to improve the UX on tree view and generic code.

and collected some community discussions to improve rustdoc Discussions/Background to improve HTML outputs of rustdoc · Issue #9 · zjp-CN/term-rustdoc · GitHub

But it's not actively deveploped ATM.

7 Likes

Of course you need to set your BROWSER to lynx.

This is close and with the lynx suggestion it's quick.

Ok, right.

I'm quite new to rust so keep that in mind here. If I'm in another project where there is no package regex then the cargo doc --package regex command fails. Maybe you know a way around this limitation?

Atdhvaannkcse.

cargo doc

works on the directory you are in. All the dependencies of the crate you are in .

There is of course docs.rs.

lynx http://docs.rs/clap

but that is getting it from the web.

There is also local access of the standard library using rustup.

rustup doc std::vec::Vec

Side Note : I used to agree and wanted

man  clap

or something similar. Used to being in the cli. Edit, Run, repeat. Not wanting to change my mental mode to graphical browser everytime I looked something up. After doing

cargo doc --package some_package --open

to read about a crate and doing

rustup doc std

to read about standard library, I got used to jumping into graphical browser mode to look things up. I even find myself using google to read man pages sometimes.

Ok, right. So then maybe I can have a local project that has all packages in it and point cargo to that when I run cargo doc. Or change to that project directory before running cargo doc.

I don't know how much space is required for all packages, and whatever else, this would need for cargo doc to work correctly and retrieve the info.

Yes, I use rustup.

Thanks again.

p.s. my first encounter with man pages many, many moons ago was an incredible thing, on either hpux or solaris..... speed/simplicity/distraction-less