refactor cli
This commit is contained in:
@@ -157,6 +157,38 @@ export class CodeQLCliServer implements Disposable {
|
||||
this.setupListeners();
|
||||
}
|
||||
|
||||
async bqrsDecode(
|
||||
bqrsPath: string,
|
||||
resultSet: string,
|
||||
{ pageSize, offset, entities = ["url", "string"] }: BqrsDecodeOptions = {},
|
||||
): Promise<DecodedBqrsChunk> {
|
||||
const args = [
|
||||
`--entities=${entities.join(",")}`,
|
||||
"--result-set",
|
||||
resultSet,
|
||||
...(pageSize ? ["--rows", pageSize.toString()] : []),
|
||||
...(offset ? ["--start-at", offset.toString()] : []),
|
||||
bqrsPath,
|
||||
];
|
||||
|
||||
return this.runJsonCodeQlCliCommand<DecodedBqrsChunk>(
|
||||
["bqrs", "decode"],
|
||||
args,
|
||||
"Reading bqrs data",
|
||||
);
|
||||
}
|
||||
|
||||
async bqrsInfo(bqrsPath: string, pageSize?: number): Promise<BqrsInfo> {
|
||||
const args = pageSize
|
||||
? ["--paginate-rows", pageSize.toString(), bqrsPath]
|
||||
: [bqrsPath];
|
||||
return this.runJsonCodeQlCliCommand<BqrsInfo>(
|
||||
["bqrs", "info"],
|
||||
args,
|
||||
"Reading bqrs header",
|
||||
);
|
||||
}
|
||||
|
||||
private setupListeners() {
|
||||
this.distributionProvider.onDidChangeDistribution?.(() =>
|
||||
this.restartCliServer(),
|
||||
|
||||
Reference in New Issue
Block a user