mirror of
https://github.com/robbyrussell/oh-my-zsh.git
synced 2026-11-26 18:33:03 +01:00
feat(talosctl): add completions for talosctl (#13682)
This commit is contained in:
1 parent
964e5b65c6
commit
ad66117d08
2 files changed
+38
No files matched your search
@@ -0,0 +1,20 @@
|
||||
# talosctl plugin
|
||||
|
||||
This plugin adds completion for the [talosctl](https://docs.siderolabs.com/talos/v1.12/learn-more/talosctl) CLI for managing [Talos](https://github.com/siderolabs/talos) Linux.
|
||||
|
||||
To use it, add `talosctl` to the plugins array in your zshrc file:
|
||||
|
||||
```zsh
|
||||
plugins=(... talosctl)
|
||||
```
|
||||
|
||||
This plugin does not add any aliases.
|
||||
|
||||
## Cache
|
||||
|
||||
This plugin caches the completion script and is automatically updated asynchronously when the plugin is
|
||||
loaded, which is usually when you start up a new terminal emulator.
|
||||
|
||||
The cache is stored at:
|
||||
|
||||
- `$ZSH_CACHE/completions/_talosctl` completions script
|
||||
@@ -0,0 +1,18 @@
|
||||
# Autocompletion for talosctl
|
||||
if (( ! $+commands[talosctl] )); then
|
||||
return
|
||||
fi
|
||||
|
||||
# If the completion file doesn't exist yet, we need to autoload it and
|
||||
# bind it to `talosctl`. Otherwise, compinit will have already done that.
|
||||
if [[ ! -f "$ZSH_CACHE_DIR/completions/_talosctl" ]]; then
|
||||
typeset -g -A _comps
|
||||
autoload -Uz _talosctl
|
||||
_comps[talosctl]=_talosctl
|
||||
fi
|
||||
|
||||
zmodload -F zsh/files b:zf_mv
|
||||
() {
|
||||
local TMPPREFIX="$ZSH_CACHE_DIR/completions/._talosctl"
|
||||
zf_mv -f -- =( talosctl completion zsh ) "$ZSH_CACHE_DIR/completions/_talosctl"
|
||||
} &|
|
||||
Reference in new issue
Block a user