Reimplement toString() method of task
This commit is contained in:
@@ -82,7 +82,24 @@ export class LazyTask implements Task {
|
||||
return this.#parsed.meta.find(x => x.feature === 'reminder')?.time;
|
||||
}
|
||||
|
||||
toString() {
|
||||
return `Task[status=${this.status}, label=${this.label}, priority=${this.priority}, created=${this.createdDate}, start=${this.startDate}, scheduled=${this.scheduledDate}, due=${this.dueDate}, completed=${this.completedDate}, cancelled=${this.cancelledDate}, recurrence=${this.recurrencyRule}, onDelete=${this.onDelete}, id=${this.id}, dependsOn=${this.dependsOn}, reminder=${this.reminder}]`
|
||||
toString(): string {
|
||||
const o = (name: string, value?: string) => value && value.length > 0 ? `${name}=${value}` : "";
|
||||
|
||||
const items = [
|
||||
o("priority", this.priority),
|
||||
o("created", this.createdDate),
|
||||
o("start", this.startDate),
|
||||
o("scheduled", this.scheduledDate),
|
||||
o("due", this.dueDate),
|
||||
o("completed", this.completedDate),
|
||||
o("cancelled", this.cancelledDate),
|
||||
o("recurrence", this.recurrencyRule),
|
||||
o("delete", this.onDelete),
|
||||
o("id", this.id),
|
||||
o("deps", this.dependsOn.join(",")),
|
||||
o("reminder", this.reminder)
|
||||
];
|
||||
|
||||
return `- [${this.status}] ${this.label} {${items.filter(x => x.length > 0).join(", ")}}`;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user