diff --git a/README.md b/README.md index 2eee710..6c4fa13 100644 --- a/README.md +++ b/README.md @@ -178,11 +178,10 @@ Example customization: Screenshot of customized version -## Bash Autocompletion - -To get bash autocompletion, simply rename the file `bash_tealdeer` to `tldr` -and copy it to `/usr/share/bash-completion/completions/tldr`. +## Autocompletion +- *Bash*: copy `bash_tealdeer` to `/usr/share/bash-completion/completions/tldr` +- *Fish*: copy `fish_tealdeer` to `~/.config/fish/completions/tldr.fish` ## Development diff --git a/fish_tealdeer b/fish_tealdeer new file mode 100644 index 0000000..9276e9a --- /dev/null +++ b/fish_tealdeer @@ -0,0 +1,21 @@ +# +# Completions for the tealdeer implementation of tldr +# https://github.com/dbrgn/tealdeer/ +# + +complete -c tldr -s h -l help -d 'Print the help message.' -f +complete -c tldr -s v -l version -d 'Show version information.' -f +complete -c tldr -s l -l list -d 'List all commands in the cache.' -f +complete -c tldr -s f -l render -d 'Render a specific markdown file.' -r +complete -c tldr -s o -l os -d 'Override the operating system.' -xa 'linux osx sunos other' +complete -c tldr -s u -l update -d 'Update the local cache.' -f +complete -c tldr -s c -l clear-cache -d 'Clear the local cache.' -f +complete -c tldr -s q -l quiet -d 'Suppress informational messages.' -f +complete -c tldr -l config-path -d 'Show config file path.' -f +complete -c tldr -l seed-config -d 'Create a basic config.' -f + +function __tealdeer_entries + tldr --list | sed -e 's/, /\n/g' +end + +complete -f -c tldr -a '(__tealdeer_entries)'