LazyAttrs
The context for getting attrs lazily on a target_node
.
LazyAttrs.get
def LazyAttrs.get(
attr: str,
) -> None | configured_attr
Gets a single attribute. Returns an optional [configured_attr]
.
def _impl_attrs_lazy(ctx):
node = ctx.cquery().owner("cell//path/to/TARGETS")[0]
attrs = node.attrs_lazy() # cache once
ctx.output.print(attrs.get("some_attributes").value())
ctx.output.print(attrs.get("some_attribute").label)