refactor: js output
This commit is contained in:
parent
1aa28c2a34
commit
c6704c3a04
96 changed files with 3816 additions and 147 deletions
40
src/commands/IssueShowCommand.js
Normal file
40
src/commands/IssueShowCommand.js
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
import { CLICommand } from "../cli/CLICommand.js";
|
||||
import { parseTodoFile } from "../file.js";
|
||||
export class IssueShowCommand extends CLICommand {
|
||||
name = "show <id>";
|
||||
help = "Show details for a single issue";
|
||||
description = "Print all fields for one issue";
|
||||
addArguments(yargs) {
|
||||
return yargs.positional("id", { type: "number", demandOption: true });
|
||||
}
|
||||
async execute(args) {
|
||||
const todo = await parseTodoFile();
|
||||
const issue = todo.issues.find(i => i.id === args.id);
|
||||
if (!issue) {
|
||||
console.error(`Issue #${args.id} not found`);
|
||||
return 1;
|
||||
}
|
||||
console.log(`ID: ${issue.id}`);
|
||||
console.log(`Type: ${issue.type}`);
|
||||
console.log(`Title: ${issue.title}`);
|
||||
console.log(`Status: ${issue.status}`);
|
||||
console.log(`Priority: ${issue.priority}`);
|
||||
console.log(`Created: ${issue.created}`);
|
||||
if (issue.module)
|
||||
console.log(`Module: ${issue.module}`);
|
||||
if (issue.dueStart)
|
||||
console.log(`DueStart: ${issue.dueStart}`);
|
||||
if (issue.dueEnd)
|
||||
console.log(`DueEnd: ${issue.dueEnd}`);
|
||||
const rels = Object.entries(issue.relationships)
|
||||
.map(([k, v]) => `${k}:${v.join(" ")}`)
|
||||
.join(", ");
|
||||
console.log(`Relationships: ${rels}`);
|
||||
console.log(`Description: ${issue.description}`);
|
||||
if (issue.body) {
|
||||
console.log();
|
||||
console.log(issue.body);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue