Skip to content

Commit 1f11e94

Browse files
authored
fix: pass sort parameter to fetchIssuesForState (#96)
- Fixes a bug where `--sort` flag was ignored after interactive prompts (like project selection) - The sort option was validated in `issue-list.ts` but `fetchIssuesForState` independently read sort from config only, causing the CLI flag to be lost
1 parent 2a49427 commit 1f11e94

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

src/commands/issue/issue-list.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,14 @@ export const listCommand = new Command()
155155
console.error(`No projects found matching: ${project}`)
156156
Deno.exit(1)
157157
}
158+
if (!Deno.stdin.isTerminal()) {
159+
console.error(
160+
`Project "${project}" not found. Similar projects: ${
161+
Object.values(projectOptions).join(", ")
162+
}`,
163+
)
164+
Deno.exit(1)
165+
}
158166
projectId = await selectOption("Project", project, projectOptions)
159167
}
160168
}
@@ -173,6 +181,7 @@ export const listCommand = new Command()
173181
allAssignees,
174182
limit === 0 ? undefined : limit,
175183
projectId,
184+
sort,
176185
)
177186
spinner?.stop()
178187
const issues = result.issues?.nodes || []

src/utils/linear.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -361,11 +361,13 @@ export async function fetchIssuesForState(
361361
allAssignees = false,
362362
limit?: number,
363363
projectId?: string,
364+
sortParam?: "manual" | "priority",
364365
) {
365-
const sort = getOption("issue_sort") as "manual" | "priority" | undefined
366+
const sort = sortParam ??
367+
getOption("issue_sort") as "manual" | "priority" | undefined
366368
if (!sort) {
367369
console.error(
368-
"Sort must be provided via configuration file or LINEAR_ISSUE_SORT environment variable",
370+
"Sort must be provided via --sort parameter, configuration file, or LINEAR_ISSUE_SORT environment variable",
369371
)
370372
Deno.exit(1)
371373
}

0 commit comments

Comments
 (0)