refactor: js output
This commit is contained in:
parent
1aa28c2a34
commit
c6704c3a04
96 changed files with 3816 additions and 147 deletions
|
|
@ -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
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue