Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Fish-based autocompletion #71

Merged
merged 3 commits into from
Dec 11, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -178,11 +178,10 @@ Example customization:
<img src="screenshot-custom.png" alt="Screenshot of customized version" width="600">


## 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

Expand Down
21 changes: 21 additions & 0 deletions fish_tealdeer
Original file line number Diff line number Diff line change
@@ -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)'