6 Commits b5d52682ca ... 9991822f8c

Author SHA1 Message Date
  Markus Hofbauer 9991822f8c feat(bazel): add bzlmod integrity gen function (#12797) 6 days ago
  Matheus Pimenta 1b9d6e5c82 feat(timoni): add completion plugin (#12802) 6 days ago
  Marc Cornellà 2e8d2d7401 fix(pipenv): fix auto-shell functionality when cd-ing out (#12813) 6 days ago
  nervo 9ad764d80c feat(vault): re-introduce vault plugin (#12753) 6 days ago
  Hu Yufan e636eeb696 fix(tailscale): load completion when `tailscale` is an alias (#12726) 6 days ago
  Olivier Mehani 081d704f32 feat(pyenv): add prompt customization (#12738) 6 days ago

+ 14 - 7
plugins/bazel/README.md

@@ -1,6 +1,7 @@
 # Bazel plugin
 # 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:
 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
 ## 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 |

+ 4 - 0
plugins/bazel/bazel.plugin.zsh

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

+ 4 - 2
plugins/pipenv/pipenv.plugin.zsh

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

+ 8 - 0
plugins/pyenv/README.md

@@ -26,6 +26,14 @@ eval "$(pyenv init --path)"
 - `ZSH_PYENV_VIRTUALENV`: if set to `false`, the plugin will not load pyenv-virtualenv
 - `ZSH_PYENV_VIRTUALENV`: if set to `false`, the plugin will not load pyenv-virtualenv
   when it finds it.
   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
 ## Functions
 
 
 - `pyenv_prompt_info`: displays the Python version in use by pyenv; or the global Python
 - `pyenv_prompt_info`: displays the Python version in use by pyenv; or the global Python

+ 8 - 2
plugins/pyenv/pyenv.plugin.zsh

@@ -88,13 +88,19 @@ if [[ $FOUND_PYENV -eq 1 ]]; then
 
 
   function pyenv_prompt_info() {
   function pyenv_prompt_info() {
     local version="$(pyenv version-name)"
     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
 else
   # Fall back to system python
   # Fall back to system python
   function pyenv_prompt_info() {
   function pyenv_prompt_info() {
+    if [[ "$ZSH_THEME_PYENV_NO_SYSTEM" == "true" ]]; then
+      return
+    fi
     local version="$(python3 -V 2>&1 | cut -d' ' -f2)"
     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
 fi
 
 

+ 7 - 2
plugins/tailscale/tailscale.plugin.zsh

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

+ 9 - 0
plugins/timoni/README.md

@@ -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)
+```

+ 14 - 0
plugins/timoni/timoni.plugin.zsh

@@ -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 - 0
plugins/vault/README.md

@@ -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)
+```

+ 7 - 0
plugins/vault/vault.plugin.zsh

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