tldr-pages / tlrc

A tldr client written in Rust
http://tldr.sh/tlrc/
MIT License
232 stars 9 forks source link

tlrc stops working if `languages = []` is set in the config #69

Closed maelnor closed 3 months ago

maelnor commented 3 months ago

After update to 1.9.0 tlrc stopped working for me with error: page not found. Try running 'tldr --update'. Update didn't work, and I tried to clean cache to force update, and after that things become strange:

> tldr --clean-cache
info: cleaning the cache directory...
> tldr --update
info: downloading 'tldr.sha256sums'... 3.27 KiB
info: there is nothing to do. Run 'tldr --clean-cache' if you want to force an update.

It thinks that there is nothing to do on clean/empty cache and did not download any pages.

> tldr tldr
info: cache is empty, downloading...
info: downloading 'tldr.sha256sums'... 3.27 KiB
info: there is nothing to do. Run 'tldr --clean-cache' if you want to force an update.
error: No such file or directory (os error 2)

After some investigation, I made it work with manually downloaded cache and explicitly set language via command line argument.

> tldr --language en tldr
  Display simple help pages for command-line tools from the tldr-pages project.
  ...

My setup: MacBook pro m1 MacOS Ventura 13.6.3 fish shell tlrc 1.9.0 via homebrew

ENV:

LANG=ru_RU.UTF-8
LANGUAGE=

config.toml:

[cache]
dir = "/Users/dvkubatkin/Library/Caches/tlrc"
auto_update = true
max_age = 336
languages = []
acuteenvy commented 3 months ago

This is a bug with language detection - an empty language config causes weird behavior, because en and languages from env vars were not added automatically. Should be fixed with https://github.com/tldr-pages/tlrc/commit/7f30db5ddb7db0a2ecb99571fdee121951f44237 - I'll create a patch release to address this. For now, you can set languages = ["ru", "en"] as a workaround.