summaryrefslogtreecommitdiff
path: root/plugins/bazel
diff options
context:
space:
mode:
authorMarkus Hofbauer <markus.hofbauer@tum.de>2024-11-19 21:20:58 +0100
committerGitHub <noreply@github.com>2024-11-19 21:20:58 +0100
commit9991822f8cfcef020fa7e99a6d47303bd900f721 (patch)
treedd8d0bfeafd4eb27743f4a867416a19b480db93b /plugins/bazel
parent1b9d6e5c82cab11ad58eb43988d4e5a256dabdc6 (diff)
downloadzsh-9991822f8cfcef020fa7e99a6d47303bd900f721.tar.gz
zsh-9991822f8cfcef020fa7e99a6d47303bd900f721.tar.bz2
zsh-9991822f8cfcef020fa7e99a6d47303bd900f721.zip
feat(bazel): add bzlmod integrity gen function (#12797)
Co-authored-by: Carlo Sala <carlosalag@protonmail.com>
Diffstat (limited to 'plugins/bazel')
-rw-r--r--plugins/bazel/README.md21
-rw-r--r--plugins/bazel/bazel.plugin.zsh4
2 files changed, 18 insertions, 7 deletions
diff --git a/plugins/bazel/README.md b/plugins/bazel/README.md
index eba4175bc..b0c34a15f 100644
--- a/plugins/bazel/README.md
+++ b/plugins/bazel/README.md
@@ -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 |
diff --git a/plugins/bazel/bazel.plugin.zsh b/plugins/bazel/bazel.plugin.zsh
index d239a06b5..818d5652b 100644
--- a/plugins/bazel/bazel.plugin.zsh
+++ b/plugins/bazel/bazel.plugin.zsh
@@ -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-/'
+}