bazelbuild / bazelbuild/bazel

Add --null flag to aquery and cquery

Open
#28,982 0 comments 0 reactions 0 assignees View on GitHub
help wanted P3 team-CLI type: feature request
Dominant language
Java
Stars
25.8k
Forks
4.6k
Avg merge
2d 20h
Merged PRs (30d)
72

Description

### Description of the feature request:

The `bazel query` command supports a [--null flag](https://bazel.build/reference/command-line-reference#query-flag--null) which expands out to [--line_terminator_null=true](https://bazel.build/reference/command-line-reference#query-flag--line_terminator_null).

This feature is useful for piping the output of the `query` command. The \0 (NUL) character is useful to unambiguously separate the output. Other tools such as GNU parallel, xargs, find, grep, etc... support separating input/output with NUL characters.

For all the reasons that the `--null` flag is useful for `query`, it should be added to `aquery` and `cquery` as well for consistency. They already support the `--line_terminator_null` flag anyway.

### Which category does this issue belong to?

CLI

### What underlying problem are you trying to solve with this feature?

There is an inconsistency in between `query`, `aquery`, and `cquery` commands.

### Which operating system are you running Bazel on?

Linux

### What is the output of `bazel info release`?

release 7.7.1

### If `bazel info release` returns `development version` or `(@non-git)`, tell us how you built Bazel.

_No response_

### What's the output of `git remote get-url origin; git rev-parse HEAD` ?

```text
https://github.com/bazelbuild/bazel.git
8b330812188b7323e852f733344fc5e1645f1a08
```

### Have you found anything relevant by searching the web?

_No response_

### Any other information, logs, or outputs that you want to share?

_No response_

Contributor guide

Open the contributing guide

Research direction

Start by comparing how the query command defines --null and --line_terminator_null, then inspect the corresponding aquery and cquery command-line entry points. Confirm the existing null line terminator behavior and identify the relevant command tests; done means both commands accept --null consistently with query.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
build-system, cli
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.