tldr-python-client
tldr-python-client copied to clipboard
Autocomplete not working on macOS
I get the error (eval):1: bad pattern: [head, when trying to autocomplete tldr pages using zsh on macOS. I assume bash will have a similar error. This is because the BSD version of sed (default on macOS) doesn't support the non-word \W regular expression extension that is used in the create_parser function. As a result, non-word characters aren't stripped from the list of tldr pages generated for the completion script and the script generates an error when attempting to autocomplete.
Replacing \W with either the POSIX compliant [^[:alnum:]_] or [^a-zA-Z0-9_] solved the problem for me and should work across GNU and BSD platforms. If you would like, I can open a pull request with the change.
Thanks for providing this client!
I think it'd be easiest to open a PR and resolve this, or alternatively have a dependency on gnu-sed on macOS (e.g. via Brew)