mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-08-07 06:08:39 +02:00
Merge f9d07dc1a7 into 0912e05c05
This commit is contained in:
commit
e1bf90fd78
2 changed files with 37 additions and 0 deletions
23
plugins/fj/README.md
Normal file
23
plugins/fj/README.md
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
# Forgejo CLI plugin
|
||||
|
||||
This plugin adds completion for the [Forgejo CLI](https://codeberg.org/forgejo-contrib/forgejo-cli).
|
||||
|
||||
To use it, add `fj` to the plugins array in your zshrc file:
|
||||
|
||||
```zsh
|
||||
plugins=(... fj)
|
||||
```
|
||||
|
||||
This plugin does not add any aliases.
|
||||
|
||||
## Cache
|
||||
|
||||
This plugin caches the completion script and is automatically updated when the
|
||||
plugin is loaded, which is usually when you start up a new terminal emulator.
|
||||
|
||||
The cache is stored at:
|
||||
|
||||
- `$ZSH/plugins/fj/_fj` completions script
|
||||
|
||||
- `$ZSH_CACHE_DIR/fj_version` version of Forgejo CLI, used to invalidate
|
||||
the cache.
|
||||
14
plugins/fj/fj.plugin.zsh
Normal file
14
plugins/fj/fj.plugin.zsh
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
# Autocompletion for the Forgejo CLI (fj).
|
||||
if (( ! $+commands[fj] )); then
|
||||
return
|
||||
fi
|
||||
|
||||
# If the completion file doesn't exist yet, we need to autoload it and
|
||||
# bind it to `fj`. Otherwise, compinit will have already done that.
|
||||
if [[ ! -f "$ZSH_CACHE_DIR/completions/_fj" ]]; then
|
||||
typeset -g -A _comps
|
||||
autoload -Uz _fj
|
||||
_comps[fj]=_fj
|
||||
fi
|
||||
|
||||
fj completion --shell zsh >| "$ZSH_CACHE_DIR/completions/_fj" &|
|
||||
Loading…
Reference in a new issue