Commit graph

349 commits

Author SHA1 Message Date
Danilo Bargen
618ecaf71f Add @niklasmohrin to crate authors 2021-10-17 22:23:35 +02:00
Danilo Bargen
371f1d2ace Help: Add a link to the online docs 2021-10-17 22:22:45 +02:00
Danilo Bargen
6823e271a0 Disable clap colors for now
May be re-introduced if clap adds a `DisableColoredHelp` setting.

Relevant discussion:

- https://github.com/clap-rs/clap/pull/2845#issuecomment-945185102
- https://github.com/dbrgn/tealdeer/pull/108#issuecomment-945182471
2021-10-17 22:10:08 +02:00
Danilo Bargen
fc726011d1 Move free-standing get_os function to OsType::current 2021-10-17 21:16:50 +02:00
Danilo Bargen
8833b6b401 Rename -m / --markdown to -r / --raw
That flag name is clearer: We output raw page data without processing.
2021-10-17 21:12:08 +02:00
Danilo Bargen
ee0d32d3de CI: Ensure that usage string is always up to date 2021-10-17 21:12:08 +02:00
Danilo Bargen
6d77483ad5 Implement Default for ColorOptions 2021-10-17 21:12:08 +02:00
Danilo Bargen
5ad7dcfa34 Argument parsing: Switch from docopt to clap 2021-10-17 21:12:08 +02:00
Danilo Bargen
6300b6a24f
Merge pull request #214 from dbrgn/remove-udeps
Remove unused dependencies
2021-10-17 19:48:05 +02:00
Danilo Bargen
84227937ae Remove some optional zip features
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.
2021-10-16 20:40:40 +02:00
Danilo Bargen
0ebd727a32 Remove tar dependency
It's unused since #213.
2021-10-16 20:36:53 +02:00
Danilo Bargen
f7da0b028d Merge pull request #213 from invakid404/use-proper-tldr-archive
Download tldr pages from proper archive URL.
2021-10-16 20:10:00 +02:00
invakid404
62725fca5f When clearing cache, only delete pages, not entire cache dir
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
2021-10-16 20:09:32 +02:00
invakid404
006ec6f3c0 Switch to recommended tldr-pages archive URL
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
2021-10-16 20:09:32 +02:00
Danilo Bargen
7bd08e35d1 Refactor cache freshness checks
- 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>
2021-10-16 20:09:16 +02:00
rnd
32cc6d5893
Use default style if user-defined style is missing (#210)
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.
2021-10-16 17:38:07 +02:00
Danny Mösch
3c92cff865
Add test for hightlighting with empty command (#178) 2021-10-16 17:20:07 +02:00
Danilo Bargen
9eca2fe5db Update copyright year 2021-10-16 13:06:28 +02:00
Tsvetomir Bonev
3f49100307
Docs: Add funtoo package to list (#208) 2021-10-03 16:10:30 +02:00
Danilo Bargen
e84fce6f90
Use tree-style imports (#204) 2021-09-13 09:06:21 +02:00
Danilo Bargen
b0449dc6bf
Merge pull request #203 from dbrgn/update-deps
Update dependencies
2021-09-12 23:29:06 +02:00
Danilo Bargen
07dc5c6bf4 Upgrade predicates and assert_cmd: 1 → 2 2021-09-12 21:12:00 +02:00
Danilo Bargen
85ab38d892 Remove dev dependency on remove_dir_all
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.
2021-09-12 21:06:06 +02:00
Danilo Bargen
7aa111e727 Upgrade reqwest: 0.10 → 0.11
This increases the release binary size by 144 KiB, but it reduces the
number of transitive dependencies from 152 to 140.
2021-09-12 20:56:24 +02:00
Danilo Bargen
b359fd8e5b Upgrade pager: 0.15 → 0.16 2021-09-12 20:42:10 +02:00
Danilo Bargen
4376162914 Upgrade env_logger: 0.7 → 0.9 2021-09-12 20:40:08 +02:00
Danilo Bargen
ffc30d1243 Run cargo update 2021-09-12 20:35:00 +02:00
Danilo Bargen
a811788b31
Merge pull request #189 from niklasmohrin/simplify_highlight_commands
Refactor formatting code
2021-09-12 20:31:45 +02:00
Danny Mösch
1471b1d97b
Create cache directory path if it does not exist (#174)
Fixes #167
2021-09-12 20:28:22 +02:00
Niklas Mohrin
3ac087ae41
Final touches for formatting refactor
- Rename: `yield_snippet` => `process_snippet`
- Rename: `HighlightingSnippet` => `PageSnippet`
2021-09-08 15:02:25 +02:00
Niklas Mohrin
b216a63c64
Add integration test for non-ascii page rendering
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.
2021-09-08 14:44:10 +02:00
Niklas Mohrin
22baa455b5
Update inkscape-default.expected 2021-09-08 14:44:09 +02:00
Niklas Mohrin
743998a75f
Reorder functions in formatter.rs
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.
2021-09-08 14:44:09 +02:00
Niklas Mohrin
808ad7ff30
Extract output logic for pages into own module
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.
2021-09-08 14:40:32 +02:00
Niklas Mohrin
e8b1c9e801
Rename Tokenizer to LineIterator
This also replaces the `next_token` method with the `next` method from
the `Iterator` trait.
2021-09-08 14:39:57 +02:00
Niklas Mohrin
62e82461cb
Refactor most of formatter.rs
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
2021-09-08 14:39:51 +02:00
Niklas Mohrin
cdbca5c53b
Add FindFrom extension trait to str to start searching at a byte offset.
This also moves the contents of `dedup.rs` into a shared module `extensions`.
2021-09-08 14:38:31 +02:00
Danilo Bargen
49f2f8a3dd Mention italic styling in docs 2021-09-06 17:02:53 +02:00
Wesley Klop
8051c3169a
Implement support for italics (#197)
Closes #146.
2021-09-06 17:01:55 +02:00
Danilo Bargen
4e0d497347
Merge pull request #201 from tranzystorek-io/refactor-misc
Add various small refactorings
2021-08-29 16:53:04 +02:00
Marcin Puc
a4ac910e86 Add various small refactorings 2021-08-29 16:12:24 +02:00
Marcin Puc
9ac67ec562 Bump CI toolchain to 1.53 2021-08-29 16:11:46 +02:00
Niklas Mohrin
d5d3d20451
Run clippy on stable with msrv setting instead of on msrv (#200) 2021-08-17 19:40:35 +02:00
Niklas Mohrin
123c809630
Merge pull request #163 from niklasmohrin/hyperfine 2021-07-30 15:46:03 +02:00
Niklas Mohrin
d1d36a961a
Update README.md to include updated benchmark results 2021-07-30 15:31:46 +02:00
Niklas Mohrin
e7c5daa9b7
Add Dockerfile for benchmarks 2021-07-30 15:31:17 +02:00
Rithvik Vibhu
187214e39e
Remove AUR links for tealdeer and tealdeer-bin (#196)
The package is now in the community repos.
2021-07-19 13:57:16 +02:00
bl-ue
a5aa822d12
README: Update @SShrike → @severen (#193) 2021-06-22 13:31:51 +02:00
Danilo Bargen
767b62d493
Merge pull request #187 from sondr3/performance-fixes
- Use unbuffered I/O for faster printing to stdout
- Replace OpenSSL with Rustls
2021-05-26 09:40:58 +02:00
Sondre Nilsen
feb20d8c5c Add WriteError type, convert print_lines to return a result 2021-05-25 16:38:28 +02:00