Skip to content

Commit

Permalink
fix: allow tags/visibility on jq rule (#19)
Browse files Browse the repository at this point in the history
fixes #18
  • Loading branch information
alexeagle authored Dec 18, 2021
1 parent ff2c2d2 commit 87cecb5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 2 additions & 1 deletion docs/jq.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Public API for jq
## jq

<pre>
jq(<a href="#jq-name">name</a>, <a href="#jq-srcs">srcs</a>, <a href="#jq-filter">filter</a>, <a href="#jq-args">args</a>, <a href="#jq-out">out</a>)
jq(<a href="#jq-name">name</a>, <a href="#jq-srcs">srcs</a>, <a href="#jq-filter">filter</a>, <a href="#jq-args">args</a>, <a href="#jq-out">out</a>, <a href="#jq-kwargs">kwargs</a>)
</pre>

Invoke jq with a filter on a set of json input files.
Expand Down Expand Up @@ -63,5 +63,6 @@ jq(
| <a id="jq-filter"></a>filter | mandatory jq filter specification (https://stedolan.github.io/jq/manual/#Basicfilters) | none |
| <a id="jq-args"></a>args | additional args to pass to jq | <code>[]</code> |
| <a id="jq-out"></a>out | Name of the output json file; defaults to the rule name plus ".json" | <code>None</code> |
| <a id="jq-kwargs"></a>kwargs | other common named parameters such as <code>tags</code> or <code>visibility</code> | none |


4 changes: 3 additions & 1 deletion lib/jq.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ _jq_rule = rule(
toolchains = ["@aspect_bazel_lib//lib:jq_toolchain_type"],
)

def jq(name, srcs, filter, args = [], out = None):
def jq(name, srcs, filter, args = [], out = None, **kwargs):
"""Invoke jq with a filter on a set of json input files.
For jq documentation, see https://stedolan.github.io/jq/.
Expand Down Expand Up @@ -57,6 +57,7 @@ def jq(name, srcs, filter, args = [], out = None):
filter: mandatory jq filter specification (https://stedolan.github.io/jq/manual/#Basicfilters)
args: additional args to pass to jq
out: Name of the output json file; defaults to the rule name plus ".json"
**kwargs: other common named parameters such as `tags` or `visibility`
"""
if not out:
out = name + ".json"
Expand All @@ -67,4 +68,5 @@ def jq(name, srcs, filter, args = [], out = None):
filter = filter,
args = args,
out = out,
**kwargs
)

0 comments on commit 87cecb5

Please sign in to comment.