mirror of
https://github.com/tealdeer-rs/tealdeer.git
synced 2026-08-23 16:44:18 +02:00
Add zsh autocompletion (#86)
This commit is contained in:
parent
ee65478930
commit
ece174e1fc
2 changed files with 38 additions and 0 deletions
|
|
@ -194,6 +194,7 @@ set the `PAGER` environment variable.
|
|||
|
||||
- *Bash*: copy `bash_tealdeer` to `/usr/share/bash-completion/completions/tldr`
|
||||
- *Fish*: copy `fish_tealdeer` to `~/.config/fish/completions/tldr.fish`
|
||||
- *Zsh*: copy `zsh_tealdeer` to `/usr/share/zsh/site-functions/_tldr`
|
||||
|
||||
## Development
|
||||
|
||||
|
|
|
|||
37
zsh_tealdeer
Normal file
37
zsh_tealdeer
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
#compdef tldr
|
||||
|
||||
_applications() {
|
||||
_values 'applications' "${(uonzf)$(tldr --list | sed -e 's/, /\n/g')}"
|
||||
}
|
||||
|
||||
_tealdeer() {
|
||||
local I="-h --help -v --version"
|
||||
integer ret=1
|
||||
local -a args
|
||||
|
||||
args+=(
|
||||
"($I -l --list)"{-l,--list}"[List all commands in the cache]"
|
||||
"($I -f --render)"{-f,--render}"[Render a specific markdown file]:file:_files"
|
||||
"($I -o --os)"{-o,--os}'[Override the operating system]:os:((
|
||||
linux
|
||||
osx
|
||||
sunos
|
||||
windows
|
||||
))'
|
||||
"($I -u --update)"{-u,--update}"[Update the local cache]"
|
||||
"($I -c --clear-cache)"{-c,--clear-cache}"[Clear the local cache]"
|
||||
"($I -p --pager)"{-p,--pager}"[Use a pager to page output]"
|
||||
"($I -q --quiet)"{-q,--quiet}"[Suppress informational messages]"
|
||||
"($I)--config-path[Show config file path]"
|
||||
"($I)--seed-config[Create a basic config]"
|
||||
'(- *)'{-h,--help}'[Display help]'
|
||||
'(- *)'{-v,--version}'[Show version information]'
|
||||
'*:file:_files'
|
||||
'1: :_applications'
|
||||
)
|
||||
|
||||
_arguments $args[@] && ret=0
|
||||
return ret
|
||||
}
|
||||
|
||||
_tealdeer
|
||||
Loading…
Add table
Add a link
Reference in a new issue