Skip to content

Added --sprint flag#983

Open
neverov wants to merge 2 commits intoankitpokhrel:mainfrom
neverov:feat/sprint-filter
Open

Added --sprint flag#983
neverov wants to merge 2 commits intoankitpokhrel:mainfrom
neverov:feat/sprint-filter

Conversation

@neverov
Copy link
Copy Markdown

@neverov neverov commented Apr 15, 2026

What does this PR solve?

Adds a --sprint flag to jira issue list so users can filter issues by sprint without dropping down to raw --jql.

The flag accepts sprint names, numeric IDs, or one of the keywords current/active, closed/previous, future/next, and is repeatable.

Input Generated JQL
--sprint "Sprint 42" sprint IN ("Sprint 42")
--sprint 1226 sprint IN (1226) (unquoted numeric ID)
--sprint current sprint IN openSprints()
--sprint closed sprint IN closedSprints()
--sprint future sprint IN futureSprints()
--sprint 1226 --sprint "Sprint 42" sprint IN (1226, "Sprint 42")
--sprint current --sprint active sprint IN openSprints() (deduplicated)

Numeric values are emitted unquoted so Jira interprets them as sprint IDs; non-numeric values are quoted as sprint names. This matches Jira's JQL semantics and allows a single mixed IN list (OR semantics) when the user passes several named/ID values.

Implementation notes:

  • New JQL.InFunc(field, fn) helper in pkg/jql for unquoted right-hand-side IN clauses (sprint IN openSprints(), mixed sprint IN (1226, "Sprint 42")).
  • Sprints []string field added to IssueParams, wired through the existing flag-parsing and JQL-building pipeline in internal/query.
  • Flag follows the same pattern as --label / --status (StringArray, repeatable).
  • Hidden under jira sprint list, where a sprint filter would be redundant.

How to test?

# Active sprint(s)
jira issue list --sprint current

# By name or numeric ID
jira issue list --sprint "Sprint 42"
jira issue list --sprint 1226

# Multiple sprints (OR semantics within a single IN clause)
jira issue list --sprint "Sprint 41" --sprint "Sprint 42"
jira issue list --sprint 1226 --sprint "Sprint 42"

# Combined with other filters
jira issue list --sprint current -s"In Progress" -yHigh

Behaviour when --sprint is omitted is unchanged (no sprint filter applied).

Unit tests cover all keyword variants, name-by-string, numeric IDs (unquoted), repeated values, mixed name+ID, keyword deduplication, and the error path. Verified end-to-end against a real Jira Cloud instance for each case above.

Checklist

  • I have added/updated enough tests related to my changes.
  • I have also manually checked and verified that my changes fix the issue and doesn't break any other functionalities.
  • My changes are backwards compatible.

Allow filtering issues by sprint when listing. The flag accepts:
- A sprint name (e.g. --sprint "Sprint 42")
- A numeric sprint ID (e.g. --sprint 123)
- Keywords: current/active (openSprints), closed/previous
  (closedSprints), future/next (futureSprints)

The flag is repeatable to filter across multiple sprints.

Also adds JQL.InFunc() helper for unquoted function-call values
in IN clauses (e.g. sprint IN openSprints()).
@neverov neverov changed the title feat(issue list): add --sprint flag Added --sprint flag Apr 15, 2026
Addresses prealloc warning from golangci-lint on CI.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant