1
0
Fork 0
mirror of https://github.com/ohmyzsh/ohmyzsh.git synced 2024-12-24 13:21:57 +00:00

Merge branch 'ohmyzsh:master' into activate-perlbrew

This commit is contained in:
jamesrtnz 2024-11-20 09:42:43 +13:00 committed by GitHub
commit cb2061db96
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 85 additions and 14 deletions

View file

@ -1,6 +1,7 @@
# Bazel plugin
This plugin adds completion and aliases for [bazel](https://bazel.build), an open-source build and test tool that scalably supports multi-language and multi-platform projects.
This plugin adds completion and aliases for [bazel](https://bazel.build), an open-source build and test tool
that scalably supports multi-language and multi-platform projects.
To use it, add `bazel` to the plugins array in your zshrc file:
@ -14,9 +15,15 @@ The plugin has a copy of [the completion script from the git repository][1].
## Aliases
| Alias | Command | Description |
| ------- | -------------------------------------- | ------------------------------------------------------ |
| bzb | `bazel build` | The `bazel build` command |
| bzt | `bazel test` | The `bazel test` command |
| bzr | `bazel run` | The `bazel run` command |
| bzq | `bazel query` | The `bazel query` command |
| Alias | Command | Description |
| ----- | ------------- | ------------------------- |
| bzb | `bazel build` | The `bazel build` command |
| bzt | `bazel test` | The `bazel test` command |
| bzr | `bazel run` | The `bazel run` command |
| bzq | `bazel query` | The `bazel query` command |
## Functions
| Function | Description |
| -------- | -------------------------------- |
| sri-hash | Generate SRI hash used by bzlmod |

View file

@ -3,3 +3,7 @@ alias bzb='bazel build'
alias bzt='bazel test'
alias bzr='bazel run'
alias bzq='bazel query'
sri-hash() {
openssl dgst -sha256 -binary $1 | openssl base64 -A | sed 's/^/sha256-/'
}

View file

@ -1,5 +1,5 @@
# Usage: dash [keyword:]query
dash() { open -a Dash.app dash://"$*" }
dash() { open -a Dash.app "dash://$(omz_urlencode -r $*)" }
compdef _dash dash
_dash() {

View file

@ -19,7 +19,8 @@ if zstyle -T ':omz:plugins:pipenv' auto-shell; then
if [[ ! -f "$PWD/Pipfile" ]]; then
if [[ "$PIPENV_ACTIVE" == 1 ]]; then
if [[ "$PWD" != "$pipfile_dir"* ]]; then
exit
unset PIPENV_ACTIVE pipfile_dir
deactivate
fi
fi
fi
@ -28,7 +29,8 @@ if zstyle -T ':omz:plugins:pipenv' auto-shell; then
if [[ "$PIPENV_ACTIVE" != 1 ]]; then
if [[ -f "$PWD/Pipfile" ]]; then
export pipfile_dir="$PWD"
pipenv shell
source "$(pipenv --venv)/bin/activate"
export PIPENV_ACTIVE=1
fi
fi
}

View file

@ -26,6 +26,14 @@ eval "$(pyenv init --path)"
- `ZSH_PYENV_VIRTUALENV`: if set to `false`, the plugin will not load pyenv-virtualenv
when it finds it.
- `ZSH_THEME_PYENV_NO_SYSTEM`: if set to `true`, the plugin will not show the system or
default Python version when it finds it.
- `ZSH_THEME_PYENV_PREFIX`: the prefix to display before the Python version in
the prompt.
- `ZSH_THEME_PYENV_SUFFIX`: the prefix to display after the Python version in
the prompt.
## Functions
- `pyenv_prompt_info`: displays the Python version in use by pyenv; or the global Python

View file

@ -88,13 +88,19 @@ if [[ $FOUND_PYENV -eq 1 ]]; then
function pyenv_prompt_info() {
local version="$(pyenv version-name)"
echo "${version:gs/%/%%}"
if [[ "$ZSH_THEME_PYENV_NO_SYSTEM" == "true" ]] && [[ "${version}" == "system" ]]; then
return
fi
echo "${ZSH_THEME_PYENV_PREFIX=}${version:gs/%/%%}${ZSH_THEME_PYENV_SUFFIX=}"
}
else
# Fall back to system python
function pyenv_prompt_info() {
if [[ "$ZSH_THEME_PYENV_NO_SYSTEM" == "true" ]]; then
return
fi
local version="$(python3 -V 2>&1 | cut -d' ' -f2)"
echo "system: ${version:gs/%/%%}"
echo "${ZSH_THEME_PYENV_PREFIX=}system: ${version:gs/%/%%}${ZSH_THEME_PYENV_SUFFIX=}"
}
fi

View file

@ -1,4 +1,4 @@
if (( ! $+commands[tailscale] )); then
if (( ! $+commands[tailscale] && ! $+aliases[tailscale] )); then
return
fi
@ -7,7 +7,12 @@ fi
if [[ ! -f "$ZSH_CACHE_DIR/completions/_tailscale" ]]; then
typeset -g -A _comps
autoload -Uz _tailscale
_comps[tailscale]=_tailscale
if (( $+commands[tailscale] )); then
_comps[tailscale]=_tailscale
elif (( $+aliases[tailscale] )); then
_comps[${aliases[tailscale]:t}]=_tailscale
fi
fi
tailscale completion zsh >| "$ZSH_CACHE_DIR/completions/_tailscale" &|

9
plugins/timoni/README.md Normal file
View file

@ -0,0 +1,9 @@
# Timoni plugin
This plugin adds completion for [Timoni](https://timoni.sh), a package manager for Kubernetes, powered by CUE and inspired by Helm.
To use it, add `timoni` to the plugins array in your zshrc file:
```zsh
plugins=(... timoni)
```

View file

@ -0,0 +1,14 @@
# Autocompletion for the Timoni CLI (timoni).
if (( ! $+commands[timoni] )); then
return
fi
# If the completion file doesn't exist yet, we need to autoload it and
# bind it to `timoni`. Otherwise, compinit will have already done that.
if [[ ! -f "$ZSH_CACHE_DIR/completions/_timoni" ]]; then
typeset -g -A _comps
autoload -Uz _timoni
_comps[timoni]=_timoni
fi
timoni completion zsh >| "$ZSH_CACHE_DIR/completions/_timoni" &|

9
plugins/vault/README.md Normal file
View file

@ -0,0 +1,9 @@
# Vault plugin
This plugin adds completion for [Vault](https://www.vaultproject.io/), the secrets and sensitive data manager.
To use it, add `vault` to the plugins array in your zshrc file:
```zsh
plugins=(... vault)
```

View file

@ -0,0 +1,7 @@
# Completion
if (( ! $+commands[vault] )); then
return
fi
autoload -Uz bashcompinit && bashcompinit
complete -o nospace -C vault vault