Commit graph

204 commits

Author SHA1 Message Date
Niklas Mohrin
22d0889d47
Update ARCHIVE_URL
When this code was written, the client specification instructed clients
that they MUST download pages from the tldr.sh domain. However, this
domain was deprecated and shut down in December 2025.
2026-01-24 01:03:15 +01:00
Danilo Bargen
ab5148f237
Fix path source for custom pages dir (#297) 2022-10-22 22:00:29 +02:00
Danilo Bargen
2ebf86b265 Remove deprecated -m/--markdown command 2022-10-01 23:54:37 +02:00
Danilo Bargen
efe1b57696 Remove deprecated -o/--os command 2022-10-01 23:53:32 +02:00
Danilo Bargen
0c93a4cfe9 Remove deprecated --config-path command 2022-10-01 23:52:03 +02:00
Danilo Bargen
c44faf2b09 Lazy creation of cache directory 2022-10-01 12:18:44 +02:00
Danilo Bargen
3f528ba5cb Impl From<RawX> for more config types
- StyleConfig
- DisplayConfig
- UpdatesConfig
2022-10-01 12:18:34 +02:00
Danilo Bargen
d702a1fab6 Cache: Add pages_dir helper method
Additionally, rename `cache_dir` to `pages_dir` where terminology was
wrong.
2022-10-01 12:18:34 +02:00
Danilo Bargen
3e7dfb3c71 Cache: Make URL a parameter, not a field 2022-10-01 12:18:33 +02:00
Danilo Bargen
fb89303e85 Move custom_pages_dir business logic from RawConfig to Config
This also introduces the path source information for that directory,
which was previously unknown.
2022-10-01 12:18:30 +02:00
Danilo Bargen
afbdfa6746 Bring back path source for cache directory 2022-10-01 12:13:40 +02:00
Danilo Bargen
33f0f108d8 Allow overriding cache directory through config
- Config: Add `cache_dir` to `[directories]` section
- Logic to handle legacy env var, config override and default cache dir
  selection is now in the `Config::try_from(RawConfig)` impl
- Deprecate old `TEALDEER_CACHE_DIR` env variable
- Update docs

Co-authored-by: Hans Gaiser <hansg91@gmail.com>
2022-10-01 12:13:39 +02:00
Danilo Bargen
026ae72742
Switch from ansi_term to yansi (#288)
ansi_term is not actively maintained anymore (see
https://rustsec.org/advisories/RUSTSEC-2021-0139). Replace it with a
suitable alternative.

I looked at termcolor, owo-colors and yansi and picked yansi:

- It is very simple
- It does not do terminal color support checking (we already do that in
  tealdeer)
- Its color enum type is almost identical to the one from ansi_term, so
  migrating is easy

The only change from a config API point of view is that "purple" is now
renamed to "magenta", but "purple" still works.
2022-09-27 23:55:50 +02:00
Olav de Haas
f4a94112f4
Add custom pages to list output (#285)
Fixes #205.
2022-09-24 21:27:35 +02:00
Niklas Mohrin
e94ee92db4
cargo clippy --fix 2022-08-21 21:53:10 +02:00
Kian-Meng Ang
97b4395e25
Fix typos (#277) 2022-06-20 12:35:17 +00:00
Evan Lloyd New-Schmidt
abbbbf01ed Add PlatformType::current for android target 2022-06-14 15:50:18 -04:00
Evan Lloyd New-Schmidt
4a5410fd0b Add support for android platform
tldr added android-specific commands under a new 'android' platform
last year: <https://github.com/tldr-pages/tldr/issues/5462>
2022-06-02 12:36:20 -04:00
Danilo Bargen
0f82aa5950
Create macOS release builds with bundled root certificates (#272)
As reported in https://github.com/dbrgn/tealdeer/issues/244, some users
on macOS had problems with `rustls-tls-native-roots`. Since we did not
find the root cause of this, we'll build macOS release builds with
`rustls-tls-webpki-roots` instead.

Fixes #244.
2022-05-06 10:43:30 +00:00
Danilo Bargen
62b6405685 Fix clap deprecation warnings 2022-05-03 22:10:18 +02:00
Danilo Bargen
5a1a21b8ab
Add note about auto-updates when cache is missing (#254) 2022-02-06 22:53:48 +01:00
cyqsimon
d5dbe3084b
Add no-auto-update flag (#257)
* Added `no-auto-update`
* Updated usage.txt
* Add `no-auto-update` to completion scripts
* Apply review suggestions
2022-01-21 09:12:10 +01:00
Danny Moesch
3b4451f8fa
Move definition of CLI arguments and options into own file (#258) 2022-01-19 23:49:23 +01:00
Danilo Bargen
77a6d48381 Pages download: Check return status 2022-01-09 21:14:30 +01:00
Danilo Bargen
71b6e037a7 When decompressing ZIP fails, propagate error
Do not unwrap. Instead, propagate the error with a anyhow context.
2022-01-09 21:14:30 +01:00
Marcin Puc
4a9763a783 Ensure that pager configuration is run at most once 2022-01-09 13:08:10 +01:00
Marcin Puc
82e4b97f92 Move pager configuration near render logic 2022-01-09 01:27:42 +01:00
Danilo Bargen
5262234846 Remove error module and clean up 2022-01-09 01:04:24 +01:00
Danilo Bargen
fd307757d7 Port cache and output modules to anyhow results 2022-01-09 01:04:07 +01:00
Danilo Bargen
405a2c9c8f Port config module to anyhow results 2022-01-09 01:04:07 +01:00
Danilo Bargen
84277cc31e
Cache: Return error if HTTP client cannot be created (#247)
Apparently `Client::new` can panic (see #244), so let's return the error instead.
2022-01-08 22:01:36 +01:00
Danilo Bargen
e722b4f92e
Rename main branch (#239) 2021-12-30 22:39:27 +01:00
Danilo Bargen
ed3d1ea9af Always add empty line before concatenating patch file 2021-12-30 21:09:37 +01:00
Danilo Bargen
fb40974616 Cache: Add tests for PageLookupResult::reader
Co-authored-by: Dalton Maahs <dalton.maahs@yourbind.com>
2021-12-30 00:01:31 +01:00
Danilo Bargen
0ef31d1f17 Concatenate page and patch bytes before processing
This way a patch file does not need a well-formed header anymore.

Fixes #181.
2021-12-30 00:01:31 +01:00
Danilo Bargen
6508ec6ac6 Ensure that default custom_pages_dir ends with trailing slash 2021-12-20 00:26:19 +01:00
Danilo Bargen
00ec281b9b Include custom pages directory in --show-paths command 2021-12-20 00:25:48 +01:00
Danilo Bargen
876f390ac6 Clap: Enable colored error messages 2021-12-11 18:00:19 +01:00
Danilo Bargen
69f4808214 Clap: Hide deprecated -o/--os argument from help 2021-12-11 18:00:19 +01:00
Danilo Bargen
25d771778a Update clap to 3.0.0-rc.4 2021-12-11 17:36:28 +01:00
Danilo Bargen
1a3624d011
Introduce command_or_file arg group (#230)
This allows to say "this command line parameter requires either a
command or a raw file".

Fixes #219.
2021-12-05 20:45:35 +01:00
Danilo Bargen
72d753c52b
Add "macos" alias for "osx" (#215)
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.
2021-12-05 16:38:35 +01:00
Danilo Bargen
023a9d2079
Lowercase page names before lookup (#227) 2021-12-05 14:31:03 +01:00
Danilo Bargen
02a395ad13
Remove last traces of short -p pager flag (#228)
I missed some occurrences in #217.
2021-12-05 14:15:49 +01:00
Danilo Bargen
2684727eaa
Add helper functions: print_warning / print_error (#223)
These functions prepend a consistend prefix and they also use colors
(when enabled).

Messages are written to stderr.
2021-12-05 14:00:59 +01:00
Danilo Bargen
0fbc95cb71
Rename -o / --os to -p / --platform (#217)
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.
2021-12-05 13:28:58 +01:00
Danilo Bargen
9c90f8ba7a
Fix clippy lints added in 1.57 (#225) 2021-12-04 21:34:06 +01:00
Danilo Bargen
746d4dadda
Fix clippy warnings (#222)
- Silence warning about excessive bools
- Implement recommendation about unneeded Option in return type
2021-10-24 23:30:10 +02:00
Marcin Puc
3beed4ad48
Simplify clap derive definition (#221)
- Use `possible_values`
- Change `render` field type to `PathBuf`
- Add comment about explicit field names
2021-10-24 23:17:43 +02:00
Danilo Bargen
371f1d2ace Help: Add a link to the online docs 2021-10-17 22:22:45 +02:00