Commit graph

72 commits

Author SHA1 Message Date
Zacchary Dempsey-Plante
17c08f0261
Change custom page files to use a .md extension (#322)
* Change custom page files to use a `.md` extension.
* Add a breaking change warning to the documentation for the usage of custom pages.
* Add a temporary check for old custom pages to assist in the migration to the new naming convention.

Co-authored-by: Danilo Bargen <mail@dbrgn.ch>
2024-02-15 19:27:56 +00:00
JJ Style
9e1489bbc5
Allow querying multiple platforms (#300) 2023-08-27 21:52:20 +00:00
tveness
76d9d0bbda
Obey 1.67 clippy lints (#313) 2023-02-07 21:56:41 +01:00
Danilo Bargen
7338933de5 Add integration test for cache_dir 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
Olav de Haas
f4a94112f4
Add custom pages to list output (#285)
Fixes #205.
2022-09-24 21:27:35 +02:00
Kian-Meng Ang
97b4395e25
Fix typos (#277) 2022-06-20 12:35:17 +00:00
Danilo Bargen
5a1a21b8ab
Add note about auto-updates when cache is missing (#254) 2022-02-06 22:53:48 +01:00
Danilo Bargen
fd307757d7 Port cache and output modules to anyhow results 2022-01-09 01:04:07 +01:00
Danilo Bargen
ed3d1ea9af Always add empty line before concatenating patch file 2021-12-30 21:09:37 +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
00ec281b9b Include custom pages directory in --show-paths command 2021-12-20 00:25:48 +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
023a9d2079
Lowercase page names before lookup (#227) 2021-12-05 14:31:03 +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
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
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
Danilo Bargen
e84fce6f90
Use tree-style imports (#204) 2021-09-13 09:06:21 +02:00
Danilo Bargen
07dc5c6bf4 Upgrade predicates and assert_cmd: 1 → 2 2021-09-12 21:12: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
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
Wesley Klop
8051c3169a
Implement support for italics (#197)
Closes #146.
2021-09-06 17:01:55 +02:00
Marcin Puc
a4ac910e86 Add various small refactorings 2021-08-29 16:12:24 +02:00
Danny Mösch
b6342633cd
Use which instead of tar as reference tldr page in tests (#192)
The page for `tar` changes pretty frequently. `which` was last updated in 2018 and is a rather simple command overall. So it is less likely that the reference in the repository has to be updated as often as the one for `tar`.
2021-05-13 14:12:11 +02:00
Dalton
4d4c7b6a5d
Fix clippy warnings (#188)
* Fix clippy warnings
* Update toolchain for CI workflows fmt and clippy
2021-05-11 13:28:26 +02:00
Dalton
388deac079
Send all progress logging messages to stderr (#171)
- Change logging messages to go to stderr
- Updated tests to expect these messages in stderr instead of stdout
- Changed test_markdown_rendering to no longer rely on the tldr pages repo
2021-05-10 09:17:13 +02:00
Danny Mösch
a92e974ac2
Update expected output for 'tar' tldr page (#186) 2021-05-09 18:05:50 +02:00
Dalton
0fce79f8ed
Add unit tests for custom pages / patches (#183) 2021-04-23 20:06:44 +02:00
Danny Mösch
7232bdd898
Allow SunOS override (#176)
Fixes #82.
2021-04-14 20:55:27 +02:00
Danny Mösch
49f151a605
Remove 'extern crate' declarations (#175)
Cargo.toml specifies Rust Edition 2018 which does not require 'extern crate' anymore.
2021-04-10 21:33:48 +02:00
Niklas Mohrin
2a6d09554b
Update tar-markdown.expected (#164) 2021-02-16 18:13:38 +01:00
Danilo Bargen
ca15279386 Show reason for choice of a certain cache/config dir 2021-02-04 23:53:14 +01:00
Danilo Bargen
978debe6ae Implement new --show-dirs command
The command prints out the different directories (config, cache, etc)
used by tealdeer.
2021-01-30 21:32:39 +01:00
Danny Mösch
1d529de260
Consider only standalone command names for styling (#157) 2021-01-29 21:22:52 +01:00
tveness
0c75e34007
Fix tar markdown rendering test (#159)
tldr-pages repository changed file
https://github.com/tldr-pages/tldr/blob/master/pages/common/tar.md
and so test was failing
2021-01-13 23:32:02 +01:00
Danilo Bargen
151d014f5d
Fix expected output for tar test (#144) 2020-10-13 09:45:21 +02:00
Bruno A. Muciño
d2b5614f1a Replace deprecated tempdir crate with tempfile crate (#139)
Fixes #134.
2020-09-04 11:59:10 +02:00
Lovecraftian Horror
dc6af5ad6c Add integration tests for the auto/never color options 2020-08-31 00:08:54 +02:00
Lovecraftian Horror
bc04e1ac00 Disable styling for --color auto if the output is being piped 2020-08-31 00:08:54 +02:00
Danilo Bargen
3597e344cb Apply rustfmt to codebase
Co-authored-by: Atul Bhosale <atul1bhosale@gmail.com>
Co-authored-by: Lovecraftian Horror <LovecraftianHorror@pm.me>
2020-08-30 18:39:29 +02:00
Niklas Mohrin
64e2c7b799
Update outdated expected output for the markdown test (#128)
Fixes #126.
2020-08-11 21:04:48 +02:00
Danilo Bargen
0b277c7515
Add test for pager warnings on Windows (#122) 2020-07-18 01:06:58 +02:00
Ilaï Deutel
a59182b6cc Use filetime instead of utime to set modification times in tests 2020-05-31 17:12:57 -07:00
Ilaï Deutel
ed1ba6beed Implement automatic cache updates 2020-05-31 17:12:57 -07:00
Danilo Bargen
06537c7218
Tests: Allow dead code for feature selection (#118)
These methods might be useful in the future, so I don't want to remove them even if they're unused. The warnings clutter diffs in CI though.
2020-05-08 22:40:34 +02:00
michaeldel
a45c19647f
Move cache age warning to stderr (#114)
Fixes #113
2020-04-16 21:42:02 +02:00
michaeldel
5dd9457cf4
Make list option comply with official spec (#112)
Separate page list with newlines, not with commas.

From the official spec:

> Additional decoration MAY be printed if the standard output is a TTY.
> If not, then the output MUST not contain any additional decorations.
> For example a page list MUST be formatted with 1 page name per line
> (to enable easy manipulation using standard CLI tools such as grep etc.).
2020-04-16 11:56:14 +02:00