The Apple computer operating system was renamed from "OS X" to "macOS"
in 2016. We should accept "macos" instead of "osx" in all our CLI APIs,
and the docs should also mention this alias instead of "osx".
For backwards compatibility and for compatibility with the tldr client
specification, we should still accept "osx" though.
This makes it compliant with the client spec.
The `-p` flag was previously used for the pager, using the pager now
requires using the long flag (`--pager`). Alternatively the pager can be
configured through the config file.
This commit also renames OsType to PlatformType.
By getting rid of the bzip2 and time features, we reduce the number of
dependencies. The official tldr pages archive uses deflate compression,
so that should be sufficient.
Squashed commits:
- chore: wipe only pages instead of entire cache dir
- fix: only delete dir if it exists
- chore: try to make variable names less confusing
- chore: display error as well
Instead of downloading the GitHub repository archive, download the pages
from the official URL instead.
Squashed commits:
- chore: use recommended tldr-pages archive url
- chore: extract pages dir to constant
- chore(deps): install zip crate
- feat: use zip crate to unpack archive
- chore(deps): drop flate2
- Create explicit CacheFreshness enum
- Do not exit inside `check_cache` function, this prevents further
actions if the cache isn't found
Co-authored-by: invakid404 <invakid404@riseup.net>
Changes the serde configuration of the `RawConfig` struct to utilize
a custom `Default` implementation to initialize new objects. This
implementation contains the default style set as it was previously
provided through the implementation of `RawConfig::new()`.
This allows to utilize the default configuration until the user
overwrites the related `RawStyleConfig` field, e.g. the description
highlighting.
Fixes#149.
It's a transitive dependency of the `tempdir` crate. It was pinned to a
specific version to achieve compatibility with Rust 1.39, but we now run
on 1.53.
Although this did not fail on old master, it is still an important case
to test. Actually, this test doesn't even break when introducing some
errors that fail i18n unit tests, unless the command name itself is
non-ascii.
As someone reading this file for the first time, I would want to see the
only public and most general function first and find the specifics
further down instead of having to look for the "module entry" first.
This moves `print_page` from `main.rs` and `print_snippet` from
`formatter.rs` into a new file `output.rs`. To decompose `print_snippet`
from `print_lines`, the latter now takes the `yield_snippet` callable as
an argument (similar to how the helper methods got a hold of it). In
order for this to work, callers have to provide a function that is
generic over all possible snippet lifetimes.
This includes
- adding the `HighlightingSnippet` enum as a common ground for
highlighting and printing code to communicate
- decomposing `print_lines` accordingly
- clearing up `highlight_code_segment` (previously `highlight_command`)
- adding unit tests (now that they can reason about
`HighlightingSnippet`s instead of having to output on the integration
test level