Skip to content

Commit 990cc7a

Browse files
committed
fix: include sort/query flags in issue list next-page hint
1 parent 86df3db commit 990cc7a

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

src/commands/issue/list.ts

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -394,6 +394,19 @@ async function fetchIssuesForTarget(
394394
}
395395
}
396396

397+
/** Build the CLI hint for fetching the next page, preserving active flags. */
398+
function nextPageHint(org: string, flags: ListFlags): string {
399+
const base = `sentry issue list ${org}/ -c last`;
400+
const parts: string[] = [];
401+
if (flags.sort !== "date") {
402+
parts.push(`--sort ${flags.sort}`);
403+
}
404+
if (flags.query) {
405+
parts.push(`-q "${flags.query}"`);
406+
}
407+
return parts.length > 0 ? `${base} ${parts.join(" ")}` : base;
408+
}
409+
397410
/** Options for {@link handleOrgAllIssues}. */
398411
type OrgAllIssuesOptions = {
399412
stdout: Writer;
@@ -445,7 +458,7 @@ async function handleOrgAllIssues(options: OrgAllIssuesOptions): Promise<void> {
445458
if (response.data.length === 0) {
446459
if (hasMore) {
447460
stdout.write(
448-
`No issues on this page. Try the next page: sentry issue list ${org}/ -c last\n`
461+
`No issues on this page. Try the next page: ${nextPageHint(org, flags)}\n`
449462
);
450463
} else {
451464
stdout.write(`No issues found in organization '${org}'.\n`);
@@ -468,7 +481,7 @@ async function handleOrgAllIssues(options: OrgAllIssuesOptions): Promise<void> {
468481

469482
if (hasMore) {
470483
stdout.write(`\nShowing ${response.data.length} issues (more available)\n`);
471-
stdout.write(`Next page: sentry issue list ${org}/ -c last\n`);
484+
stdout.write(`Next page: ${nextPageHint(org, flags)}\n`);
472485
} else {
473486
stdout.write(`\nShowing ${response.data.length} issues\n`);
474487
}

0 commit comments

Comments
 (0)