dbrgn / tealdeer

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

added checks for wrong `tldr --list` output in completions #327

Closed iliya-malecki closed 1 year ago

iliya-malecki commented 1 year ago

when tldr-pages doesnt exist (yet, as in, new installation), tldr --list will output something that makes no sense for the completions. I am not qualified to do a real fix, but the completions output did bug me enough to patch it for zsh and bash. I tried to patch it for fish as well but couldnt get the original completion to work so im leaving the problem for actual fish users.

TL;DR: Purpose: reduce annoyance during first use, which is important for user-friendliness Method: patch completions with a simple if-no-error check, for zsh and bash.

niklasmohrin commented 1 year ago

Thanks!

For fish, it could probably be something like

if set entries (tldr --list 2>/dev/null)
    string replace -a -i -r "\,\s" "\n" $entries
end