Commit Graph

40 Commits

Author SHA1 Message Date
Robin Krahl
60e8de7fdc
Release v0.5.0 2021-10-26 23:42:34 +02:00
Robin Krahl
4026f2d191
Update dependencies 2021-06-19 13:37:39 +02:00
Robin Krahl
1d808c4583
Update cursive dependencies
This patch updates the cursive dependencies to use cursive_core 0.2.
2021-06-19 13:28:56 +02:00
Robin Krahl
3d1670e526
Release v0.4.3
This patch release adds support for Rust 1.53.0 and for non-default
target directories.
2021-06-19 13:11:19 +02:00
Robin Krahl
2955560060
Release v0.4.2
This patch releases adds support for the new search index format (Rust
1.52.0 and later).
2021-06-06 14:59:15 +02:00
Robin Krahl
2c1b91462e
Release v0.4.1
This patch release fixes an issue with the pager configuration.
2020-10-11 22:41:05 +02:00
Robin Krahl
56cb98e867
Release v0.4.0
This minor release introduces a new interactive viewer, tui.  It also
adds syntax highlighting for code in the documentation and support for
Rust 1.47.0.
2020-10-09 12:16:01 +02:00
Robin Krahl
7756803e35
Remove textwrap dependency
The textwrap dependency was added mistakenly.
2020-10-08 10:33:39 +02:00
Robin Krahl
b93dbca7f0
Replace ansi_term, atty, terminal_size with termion
In the last patch, we added the termion dependency for the tui viewer.
With this patch, we remove the ansi_term, atty and terminal_size
dependencies and use termion instead.
2020-10-08 10:32:05 +02:00
Robin Krahl
8db34e33b2
Use termion backend for cursive
With this patch, we replace cursive’s default ncurses backend with the
termion backend.  This has multiple reasons:
- The ncurses backend has safety issues, see [0].
- ncurses requires a pre-installed library and a C compiler, introducing
  additional build dependencies.  Termion is implemented in Rust only.
- ncurses does not work on Windows, while termion works in all terminals
  that support ANSI escape codes.

Per default, the termion backend does not buffer the output which may
cause flickering [1].  Therefore, we also use the
cursive_buffered_backend that buffers the output and fixes the
flickering problem.

[0] https://github.com/gyscos/cursive/issues/488
[1] https://github.com/gyscos/cursive/issues/142
2020-10-08 10:30:17 +02:00
Robin Krahl
568fb0acc8
Use cursive-markup to replace HtmlView
We’ve moved the HtmlView into a separate crate, so we can replace our
own HtmlView with cursive_markup::MarkupView.  We only have to implement
a custom Renderer that applies the syntax highlighting to code snippets.
2020-10-08 10:00:26 +02:00
Robin Krahl
e222a1f443
Add TUI viewer using cursive
This patch adds a new viewer, tui, that provides an interactive
interface using cursive.  This viewer makes it possible to follow links
to other documentation items and to open external links in a web
browser.
2020-10-06 19:19:13 +02:00
Robin Krahl
ecc05ddc7d
Update html2text dependency to v0.2.1
This patch updates the html2text dependency to v0.2.1.  This release
fixed the handling of preformatted blocks, allowing us to add syntax
highlighting for code blocks in the next patch.
2020-10-03 19:04:45 +02:00
Robin Krahl
9458b280d4
Use text-style crate to format text
This patch replaces the direct text formatting with ansi_term with the
text-style crate.  This also allows us to directly convert the syntect
annotations to styled strings.
2020-10-03 15:44:00 +02:00
Robin Krahl
ecb3d40c59
Use ansi_term, atty, terminal_size
This patch replaces the crossterm dependency with ansi_term, atty and
terminal_size.  This allows us for an easier integration with the
text_style crate in an upcoming patch, and it reduces the total number
of dependencies from 166 to 160.

This means that we drop support for non-ANSI terminals, but as this only
affects old versions of cmd.exe/PowerShell, we don’t care about it.
2020-10-02 13:10:37 +02:00
Robin Krahl
225e19a024
Use merge to merge arguments and configuration
This patch adds the merge dependency to automatically merge the
command-line arguments and the settings from the configuration file.
This means that we no longer have to manually maintain the Args::merge
function.
2020-09-20 22:18:28 +02:00
Robin Krahl
642bec6687
Release v0.3.0
This minor release adds support for Rust 1.46.0 and significantly
improves the test suite.
2020-09-11 21:58:29 +02:00
Robin Krahl
628377c83b
Refactor test suite to check multiple versions
This patch refactors the test suite:
- Instead of always generating the documentation with the available
  rustdoc version, we now store generated documentation for all
  supported rustdoc versions in the test/html directory.
- Instead of using one snapshot per test case, we now use one snapshot
  per test case and rustdoc version.
2020-09-11 20:30:05 +02:00
Robin Krahl
e74ef86ebe
Move ItemType u8 representations into index module
Previosuly, we used the u8 values for the ItemType variants used in the
search index as the discriminant.  But as the ID used in the search
index is an implementation detail of the index parser, this patch moves
the mapping to the index module.
2020-08-17 13:42:10 +02:00
Robin Krahl
76845785ee
Release v0.2.0
This minor release adds support for syntax highlighting of code snippets
and for configuration files.
2020-08-11 10:31:03 +02:00
Robin Krahl
1a518d7509
Add integration tests
This patch adds an integration test suite using the insta crate for
snapshot testing.  The test suite is tested for all supported Rust
versions and should always succeed for the MSRV (currently 1.40.0) and
the current stable Rust version.

However there are some minor changes in the configuration format between
Rust versions, so tests that don’t work on all supported Rust versions
are marked with the ignore attribute.  But even the ignored tests should
work on the stable Rust release.
2020-08-11 09:31:20 +02:00
Robin Krahl
e5ee4df73b
Add support for configuration files
With this patch, we load defaults for the command-line arguments from
the configuration file located in the user configuration directory
according to the XDG Base Directory Specification.
2020-08-10 23:37:26 +02:00
Robin Krahl
dc7b5b1eca
Add syntax highlighting for code snippets
This patch uses syntect to add syntax highlighting for code snippets in
the rich text output.  Currently, this only applies to the examples
printed with the -e/--examples option.
2020-08-10 19:41:12 +02:00
Robin Krahl
44028e228a
Release v0.1.3
This patch release adds support for documentation generated with Rust
1.45.0 and fixes some minor bugs in the documentation parser.  It also
adds the documentation downloaded using rustup to the default sources.
2020-07-28 14:59:12 +02:00
Robin Krahl
4d7c7d4eab
Release v0.1.2
This patch release adds basic logging output and a new `-e`/`--examples`
option to extract only the examples from the documentation.  It also
fixes a bug when displaying the documentation for a function.
2020-07-25 13:29:14 +02:00
Robin Krahl
e69e4af31c
Add basic logging with env_logger
This patch adds some basic info log messages to make it easier to debug
incompatible rustdoc output.  To show the messages, run rusty-man with
the environment variable RUST_LOG=info.
2020-07-24 18:10:53 +02:00
Robin Krahl
af1b81dd57
Release v0.1.1
This patch release fixes some minor issues with the documentation
displayed on crates.io.
2020-07-24 14:26:25 +02:00
Robin Krahl
54dd0d9ee9
Add homepage and repository links to Cargo.toml 2020-07-24 14:23:31 +02:00
Robin Krahl
ae51e80d46
Update keywords and excludes in Cargo.toml 2020-07-24 13:47:55 +02:00
Robin Krahl
41dd007390
Use crossterm instead of termion
With this patch, we replace the termion dependency with crossterm.  This
should make it possible to compile and run rusty-man on other platforms
than Unix.
2020-07-24 13:18:35 +02:00
Robin Krahl
8bfb7393e5
List variants for enums
This patch updates parse_item_doc to look for variants.
2020-07-22 19:37:48 +02:00
Robin Krahl
f799d860ca
Import item types from librustdoc
Previously, our ItemType enum only had three values: Module, Item and
Member.  With this patch we import the ItemType variants from librustdoc
(see html/item_type.rs) for better compatibility and easier parsing.
2020-07-22 17:15:00 +02:00
Robin Krahl
61fdf31c0a
Read search index from search-index.js
With this patch, we read the search index generated by rustdoc.  It
allows us to suggest matching items if we don’t find an exact match.
2020-07-19 22:23:47 +02:00
Robin Krahl
646b36708b
Replace “interface” with “viewer” in description
Previously, we called rusty-man a command-line interface for rustdoc
documentation, but “viewer” is a more appropriate term.
2020-07-19 17:24:38 +02:00
Robin Krahl
02b3116ecd Adapt text output to terminal size
Previously, we wrapped all lines at 100 characters and just printed to
stdout.  With this patch, we use the pager crate to spawn a pager
(typically less) before printing the text.  Also, we try to use the
terminal size to determine the line length:  The default line length is
still 100 characters but can be reduced to fit the terminal.
2020-07-19 16:04:10 +02:00
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.
2020-07-19 16:00:20 +02:00
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.
2020-07-19 15:44:21 +02:00
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.
2020-07-19 15:40:10 +02:00
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.
2020-07-19 14:11:00 +02:00
Robin Krahl
3967de8bd2 Initial project scaffolding
This patch contains the initial project scaffolding, based on the files
generated by cargo new.
2020-07-19 14:10:54 +02:00