mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-03-28 18:53:47 +08:00
feat: add fnox plugin w/ optional mise integration
This commit is contained in:
parent
52d93f18d6
commit
0e570d7dcd
26
plugins/fnox/README.md
Normal file
26
plugins/fnox/README.md
Normal file
@ -0,0 +1,26 @@
|
||||
# fnox
|
||||
|
||||
Adds integration and shell completions for [fnox](https://github.com/jdx/fnox), a tool for provider-agnostic secret injection.
|
||||
Supports either standalone activation or `mise` integration if installed.
|
||||
|
||||
## Installation
|
||||
|
||||
1. *Optional:* [Download & install mise](https://github.com/jdx/mise#installation) by running the following:
|
||||
|
||||
```bash
|
||||
curl https://mise.jdx.dev/install.sh | sh
|
||||
```
|
||||
|
||||
2. [Enable fnox](https://fnox.jdx.dev/guide/quick-start.html) by adding it to your `plugins` definition in `~/.zshrc`.
|
||||
|
||||
```bash
|
||||
# standalone
|
||||
plugins=(fnox)
|
||||
|
||||
# with mise integration
|
||||
plugins=(mise fnox)
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
See the [fnox documentation](https://github.com/jdx/fnox#table-of-contents) for information on how to use `fnox` [standalone](https://fnox.jdx.dev/guide/shell-integration.html) or with [`mise` integration](https://fnox.jdx.dev/guide/mise-integration.html).
|
||||
20
plugins/fnox/fnox.plugin.zsh
Normal file
20
plugins/fnox/fnox.plugin.zsh
Normal file
@ -0,0 +1,20 @@
|
||||
if (( ! $+commands[fnox] )); then
|
||||
# if we don't have fnox at all just bail out
|
||||
return
|
||||
fi
|
||||
|
||||
if (( ! $+commands[mise] )); then
|
||||
# if we have fnox but not mise, source its activation directly
|
||||
eval "$(fnox activate zsh)"
|
||||
fi
|
||||
|
||||
# If the completion file doesn't exist yet, we need to autoload it and
|
||||
# bind it to `mise`. Otherwise, compinit will have already done that.
|
||||
if [[ ! -f "$ZSH_CACHE_DIR/completions/_fnox" ]]; then
|
||||
typeset -g -A _comps
|
||||
autoload -Uz _fnox
|
||||
_comps[fnox]=_fnox
|
||||
fi
|
||||
|
||||
# Generate and load completions
|
||||
fnox completion zsh >| "$ZSH_CACHE_DIR/completions/_fnox" &|
|
||||
Loading…
Reference in New Issue
Block a user