init
This commit is contained in:
commit
932d4ad420
46 changed files with 5800 additions and 0 deletions
42
lib/commands/IssueShowCommand.ts
Normal file
42
lib/commands/IssueShowCommand.ts
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
import type { Argv, ArgumentsCamelCase } from "yargs"
|
||||
import { CLICommand } from "../cli/CLICommand"
|
||||
import { parseTodoFile } from "../file"
|
||||
|
||||
export class IssueShowCommand extends CLICommand {
|
||||
readonly name = "show <id>"
|
||||
readonly help = "Show details for a single issue"
|
||||
readonly description = "Print all fields for one issue"
|
||||
|
||||
addArguments(yargs: Argv): Argv {
|
||||
return yargs.positional("id", { type: "number", demandOption: true })
|
||||
}
|
||||
|
||||
async execute(args: ArgumentsCamelCase): Promise<number> {
|
||||
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 as number[]).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