Skip to content

Commit 5fa6d7c

Browse files
committed
1 parent e7655f0 commit 5fa6d7c

File tree

4 files changed

+43
-15
lines changed

4 files changed

+43
-15
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
- more consistent rendering of priority
1616
- labels column width now dynamically sized based on actual label content
17+
- state flag on issue list can now be repeated to filter by multiple states
1718

1819
### Added
1920

@@ -23,6 +24,7 @@
2324
- `issue delete` command to delete issues by id
2425
- allow specifying a --parent on linear issue create
2526
- add -A and -U flags to issue start command for filtering assignees
27+
- add --all-states flag to issue list command to show issues from all states
2628

2729
## [0.6.4] - 2025-08-12
2830

src/commands/issue/issue-list.ts

Lines changed: 34 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -25,18 +25,16 @@ export const listCommand = new Command()
2525
.type("sort", SortType)
2626
.type("state", StateType)
2727
.option(
28-
"--sort <sort:sort>",
29-
"Sort order (can also be set via LINEAR_ISSUE_SORT)",
28+
"-s, --state <state:state>",
29+
"Filter by issue state (can be repeated for multiple states)",
3030
{
31-
required: false,
31+
default: ["unstarted"],
32+
collect: true,
3233
},
3334
)
3435
.option(
35-
"-s, --state <state:state>",
36-
"Filter by issue state",
37-
{
38-
default: "unstarted",
39-
},
36+
"--all-states",
37+
"Show issues from all states",
4038
)
4139
.option(
4240
"--assignee <assignee:string>",
@@ -50,11 +48,27 @@ export const listCommand = new Command()
5048
"-U, --unassigned",
5149
"Show only unassigned issues",
5250
)
51+
.option(
52+
"--sort <sort:sort>",
53+
"Sort order (can also be set via LINEAR_ISSUE_SORT)",
54+
{
55+
required: false,
56+
},
57+
)
5358
.option("-w, --web", "Open in web browser")
5459
.option("-a, --app", "Open in Linear.app")
5560
.action(
5661
async (
57-
{ sort: sortFlag, state, assignee, allAssignees, unassigned, web, app },
62+
{
63+
sort: sortFlag,
64+
state,
65+
assignee,
66+
allAssignees,
67+
unassigned,
68+
web,
69+
app,
70+
allStates,
71+
},
5872
) => {
5973
if (web || app) {
6074
console.error(
@@ -67,15 +81,23 @@ export const listCommand = new Command()
6781
}
6882

6983
// Validate that conflicting flags are not used together
70-
const flagCount =
84+
const assigneeFilterCount =
7185
[assignee, allAssignees, unassigned].filter(Boolean).length;
72-
if (flagCount > 1) {
86+
if (assigneeFilterCount > 1) {
7387
console.error(
7488
"Cannot specify multiple assignee filters (--assignee, --all-assignees, --unassigned)",
7589
);
7690
Deno.exit(1);
7791
}
7892

93+
// Validate state filters are not used together
94+
if (allStates && (state.length > 1 || state[0] !== "unstarted")) {
95+
console.error(
96+
"Cannot use --all-states with --state flag",
97+
);
98+
Deno.exit(1);
99+
}
100+
79101
const sort = sortFlag ||
80102
getOption("issue_sort") as "manual" | "priority" | undefined;
81103
if (!sort) {
@@ -102,7 +124,7 @@ export const listCommand = new Command()
102124
try {
103125
const result = await fetchIssuesForState(
104126
teamId,
105-
state,
127+
allStates ? undefined : state,
106128
assignee,
107129
unassigned,
108130
allAssignees,

src/commands/issue/issue-start.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export const startCommand = new Command()
3838
try {
3939
const result = await fetchIssuesForState(
4040
teamId,
41-
"unstarted",
41+
["unstarted"],
4242
undefined,
4343
unassigned,
4444
allAssignees,

src/utils/linear.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ export async function fetchParentIssueTitle(
177177

178178
export async function fetchIssuesForState(
179179
teamId: string,
180-
state: string,
180+
state: string[] | undefined,
181181
assignee?: string,
182182
unassigned = false,
183183
allAssignees = false,
@@ -193,9 +193,13 @@ export async function fetchIssuesForState(
193193
// Build filter and query based on the assignee parameter
194194
const filter: IssueFilter = {
195195
team: { key: { eq: teamId } },
196-
state: { type: { in: [state] } },
197196
};
198197

198+
// Only add state filter if state is specified
199+
if (state) {
200+
filter.state = { type: { in: state } };
201+
}
202+
199203
if (unassigned) {
200204
filter.assignee = { null: true };
201205
} else if (allAssignees) {

0 commit comments

Comments
 (0)