Skip to content

Commit

Permalink
Add an example for how to select rules whose dict-type attribute has …
Browse files Browse the repository at this point in the history
…a particular key and value

PiperOrigin-RevId: 716669606
Change-Id: I9dfa473901cbcc8c37f98acdc1b6d1d16e0388f9
  • Loading branch information
Googler authored and copybara-github committed Jan 17, 2025
1 parent 3697c91 commit c3a3804
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions site/en/query/language.md
Original file line number Diff line number Diff line change
Expand Up @@ -940,6 +940,27 @@ attr("tags", "[\[ ]value[,\]]", deps(//foo))
This works because the character before `value` will be `[` or a space and the
character after `value` will be a comma or `]`.

To select all rules among `//foo` dependencies with a particular `key` and
`value` in a dict-type attribute, use

```
attr("some_dict_attribute", "[\{ ]key=value[,\}]", deps(//foo))
```

This would select `//foo` if `//foo` is defined as

```
some_rule(
name = "foo",
some_dict_attribute = {
"key": "value",
},
)
```

This works because the character before `key=value` will be `{` or a space and
the character after `key=value` will be a comma or `}`.

### Rule visibility filtering: visible {:#visible}

```
Expand Down

0 comments on commit c3a3804

Please sign in to comment.