9 Commits (fdabe11c4a6a068d8ac09075442ec799c0569bec)
 

Author SHA1 Message Date
Robin Krahl fdabe11c4a Select default viewer based on TTY
Previosuly, the plain text viewer was the default option.  But for
interactive use, rich text output would be a more sensible default.
With this patch, we check whether we are called from a TTY to choose the
default viewer:  rich for interactive use, text for non-interactive use.
4 years ago
Robin Krahl 96df0924ba Add rich viewer
This patch adds a new viewer with rich text output using html2text’s
from_read_rich function.  We then use termion to format the generated
rich text.
4 years ago
Robin Krahl 7c228e5009 Add custom TextDecorator implementation
html2text’s PlainDecorator that is used to produce plain text prints all
link targets at the end of a block.  While this is generally useful,
listing all local links makes the output hard to read.  JavaScript and
Rust plaground links are generally not very useful in this context.

Therefore we implement a custom TextDecorator that only lists external
links (http or https) and ignores links to the Rust playground.
4 years ago
Robin Krahl 5ce0365c7f Add --viewer option and plain text viewer
This patch adds a new --viewer command line option that lets the user
select a viewer that displays the documentation.  It also adds a default
viewer implementation that uses html2text to generate plain text from
the HTML documentation.

html2text requires the ptr_cast feature and we use the Option::as_deref
method in the viewer implementation, so we have to update the minimum
supported Rust version to 1.40.
4 years ago
Robin Krahl 0309107bc3 Add default source directories
This patch adds typical Rust documentation locations to the sources:
- /usr/share/doc/rust{,-doc}/html for the standard library documentation
- ./target/doc for the documentation generated for the current crate

It also adds the --no-default-sources option that disables this
behavior.
4 years ago
Robin Krahl 6993df9cb6 Extract documentation from HTML files
This patch adds the parser module that uses kuchiki and html5ever to
parse the HTML documentation.

As kuchiki requires std::mem::MaybeUninit, we have to bump the minimum
supported Rust version to 1.36.
4 years ago
Robin Krahl e6f299635e Implement basic doc item data structures
This patch adds the doc and source module with the basic data structures
for the documentation items:
- A Source loads the documentation items from e. g. the file system.
- The documentation items (modules, traits, etc.) are grouped by crates.

It also adds a simple Source implementation, DirSource, that reads the
data from a local directory.
4 years ago
Robin Krahl 11b6d27b8a Implement command-line interface using structopt
This patch adds the structopt dependency and implements a simple
command-line interface for rusty-man.
4 years ago
Robin Krahl 3967de8bd2 Initial project scaffolding
This patch contains the initial project scaffolding, based on the files
generated by cargo new.
4 years ago