Skip to content

Commit

Permalink
enable query info in shell
Browse files Browse the repository at this point in the history
  • Loading branch information
ptpaterson committed Dec 14, 2024
1 parent 9779b52 commit e84987c
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions src/commands/shell.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,6 @@ async function buildCustomEval(argv) {
// These are options used for querying and formatting the response
const { apiVersion, color, include } = argv;
const performanceHints = getArgvOrCtx("performanceHints", argv, ctx);
const summary = getArgvOrCtx("summary", argv, ctx);

// Using --json output takes precedence over --format
const outputFormat = resolveFormat({ ...argv });
Expand Down Expand Up @@ -179,13 +178,16 @@ async function buildCustomEval(argv) {
format: outputFormat,
});

if ((summary || performanceHints) && apiVersion === "10") {
const formattedSummary = formatQueryInfo(
{ summary: res.summary },
{ apiVersion, color, include },
);
if (formattedSummary) {
logger.stdout(formattedSummary);
// If any query info should be displayed, print to stderr.
// This is only supported in v10.
if (include.length > 0 && apiVersion === "10") {
const queryInfo = formatQueryInfo(res, {
apiVersion,
color,
include,
});
if (queryInfo) {
logger.stdout(queryInfo);
}
}
} catch (err) {
Expand Down

0 comments on commit e84987c

Please sign in to comment.