refactor: js output
This commit is contained in:
parent
1aa28c2a34
commit
c6704c3a04
96 changed files with 3816 additions and 147 deletions
29
src/commands/IssuesInSprintCommand.js
Normal file
29
src/commands/IssuesInSprintCommand.js
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
import { CLICommand } from "../cli/CLICommand.js";
|
||||
import { parseTodoFile } from "../file.js";
|
||||
export class IssuesInSprintCommand extends CLICommand {
|
||||
name = "issues-in-sprint <name>";
|
||||
help = "List issues in a sprint";
|
||||
description = "Find issues whose date range overlaps with a sprint";
|
||||
addArguments(yargs) {
|
||||
return yargs.positional("name", { type: "string", demandOption: true });
|
||||
}
|
||||
async execute(args) {
|
||||
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