Skip to content

Commit

Permalink
Add descriptions of --output formats (proto, streamed_proto, textprot…
Browse files Browse the repository at this point in the history
…o, streamed_jsonproto) to the query docs (which were previously missing).
  • Loading branch information
zhengwei143 committed Sep 28, 2023
1 parent 612bf5c commit 4305e69
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 1 deletion.
46 changes: 46 additions & 0 deletions site/en/query/language.md
Original file line number Diff line number Diff line change
Expand Up @@ -1193,6 +1193,52 @@ Like `label`, this output format prints the labels of
each target in the resulting graph, in topological order, but it
additionally precedes the label by the [_kind_](#kind) of the target.

### Print targets in protocol buffer format {:#print-target-proto}

```
--output proto
```

Prints the query output as a
[`QueryResult`](https://github.com/bazelbuild/bazel/blob/master/src/main/protobuf/build.proto)
protocol buffer.

### Print targets in length-delimited protocol buffer format {:#print-target-length-delimited-proto}

```
--output streamed_proto
```

Prints a
[length-delimited](https://protobuf.dev/programming-guides/encoding/#size-limit)
stream of
[`Target`](https://github.com/bazelbuild/bazel/blob/master/src/main/protobuf/build.proto)
protocol buffers. This is useful to get around
[size limitations](https://protobuf.dev/programming-guides/encoding/#size-limit)
of protocol buffers when there are too many targets to fit in a single
`QueryResult`.

### Print targets in text proto format {:#print-target-textproto}

```
--output textproto
```

Similar to `--output proto`, prints the
[`QueryResult`](https://github.com/bazelbuild/bazel/blob/master/src/main/protobuf/build.proto)
protocol buffer but in
[text format](https://protobuf.dev/reference/protobuf/textformat-spec/).

### Print targets in ndjson format {:#print-target-streamed-jsonproto}

```
--output streamed_jsonproto
```

Similar to `--output streamed_proto`, prints a stream of
[`Target`](https://github.com/bazelbuild/bazel/blob/master/src/main/protobuf/build.proto)
protocol buffers but in [ndjson](http://ndjson.org/) format.

### Print the label of each target, in rank order {:#print-target-label-rank-order}

```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public OrderOutputConverter() {
help =
"The format in which the query results should be printed. Allowed values for query are:"
+ " build, graph, streamed_jsonproto, label, label_kind, location, maxrank, minrank,"
+ " package, proto, xml.")
+ " package, proto, streamed_proto, textproto, xml.")
public String outputFormat;

@Option(
Expand Down

0 comments on commit 4305e69

Please sign in to comment.