refactor: js output

This commit is contained in:
Tiara Rodney 2026-03-15 05:11:59 +01:00
parent 1aa28c2a34
commit c6704c3a04
No known key found for this signature in database
GPG key ID: 5CD8EC1D46106723
96 changed files with 3816 additions and 147 deletions

View file

@ -1,33 +0,0 @@
import type { Argv, ArgumentsCamelCase } from "yargs"
import { CLICommand } from "../cli/CLICommand"
import { parseTodoFile } from "../file"
export class IssuesInSprintCommand extends CLICommand {
readonly name = "issues-in-sprint <name>"
readonly help = "List issues in a sprint"
readonly description = "Find issues whose date range overlaps with a sprint"
addArguments(yargs: Argv): Argv {
return yargs.positional("name", { type: "string", demandOption: true })
}
async execute(args: ArgumentsCamelCase): Promise<number> {
const todo = await parseTodoFile()
const sprint = todo.sprints.find(s => s.name === args.name)
if (!sprint) {
console.error(`Sprint not found: ${args.name}`)
return 1
}
const { start, end } = sprint
for (const issue of todo.issues) {
const ds = issue.dueStart ?? issue.dueEnd
const de = issue.dueEnd ?? issue.dueStart
if (!ds || !de) continue
if (ds <= end && de >= start) {
console.log(`#${issue.id} [${issue.type}] (${issue.status}) ${issue.title}`)
}
}
return 0
}
}