Skip to content

Instantly share code, notes, and snippets.

@visortelle
Last active April 30, 2020 18:06
Show Gist options
  • Save visortelle/ba1b9171f672e0acf060275f38cd4e33 to your computer and use it in GitHub Desktop.
Save visortelle/ba1b9171f672e0acf060275f38cd4e33 to your computer and use it in GitHub Desktop.
bazel-bash-helpers
## Print availabel bazel rules by path
## Usage bazel_rules '//src'
function bazel_rules(){
bazel query "attr(name, \".*\", $@:*)" 2> /dev/null
}
## Print availabel bazel rules by path
## Usage bazel_public_rules '//src'
function bazel_public_rules() {
bazel query "attr(visibility, \"//visibility:public\", $@:*)" 2> /dev/null
}
## Build graphviz graph and put it into clipboard, then open webgraphviz.com in browser (MacOS only).
## Usage: bazel_graph '//src:build', then paste clipboard content into graph input.
function bazel_graph(){
bazel query --notool_deps --noimplicit_deps "deps($@)" --output graph 2> /dev/null | pbcopy && open http://www.webgraphviz.com/
}
## "bazlisk" is a version manager for bazel that respecting .bazelversion file.
## Repo: https://github.com/bazelbuild/bazelisk
alias bazel="bazelisk"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment