dbrgn / tealdeer

A very fast implementation of tldr in Rust.
https://dbrgn.github.io/tealdeer/
Apache License 2.0
4.09k stars 124 forks source link

Search other Platforms when command isn't found #278

Open k12ish opened 2 years ago

k12ish commented 2 years ago

Taken from the TLDR client specification:

If a page is not available for either the host platform or the common platform, then clients SHOULD search other platforms and display a page from there - along with a warning message.

On Windows, tealdeer outputs this:

$ tldr fuser
Warning: Page `fuser` not found in cache.
Try updating with `tldr --update`, or submit a pull request to:
https://github.com/tldr-pages/tldr

This lead me to believe that fuser didn't have a page, and I mistakenly submitted a PR

I suspect that I'm not the only person to have had this problem, and I would appreciate if we could get this fixed.

marchersimon commented 2 years ago

The relevant code is from here (line 292) https://github.com/dbrgn/tealdeer/blob/97b4395e258ae809060dd6cdceb5cab9c76dadcc/src/cache.rs#L292

to line 301. It first searches the current platform, then common, and then stops.

osalbahr commented 1 year ago

I can confirm the problem happens to me too:

~ $ tldr -u
Successfully updated local database
~ $ tldr fuser
This page doesn't exist yet!
Submit new pages here: https://github.com/tldr-pages/tldr
~ $ tldr gcc

gcc

Preprocess and compile C and C++ source files, then assemble and link them together.
More information: <https://gcc.gnu.org>.

- Compile multiple source files into executable:
    gcc path/to/source1.c path/to/source2.c ... -o path/to/output_executable

- Show common warnings, debug symbols in output, and optimize without affecting debugging:
    gcc path/to/source.c -Wall -g -Og -o path/to/output_executable

- Include libraries from a different path:
    gcc path/to/source.c -o path/to/output_executable -Ipath/to/header -Lpath/to/library -llibrary_name

- Compile source code into Assembler instructions:
    gcc -S path/to/source.c

- Compile source code into an object file without linking:
    gcc -c path/to/source.c

~ $