Add completion date
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
import fs from "fs";
|
import fs from "fs";
|
||||||
import { Task } from "../types/task";
|
import { Task } from "../types/task";
|
||||||
import { Config } from "../types/config";
|
import { Config } from "../types/config";
|
||||||
|
import dayjs from "dayjs";
|
||||||
|
|
||||||
export function complete(config: Config, profile: string, task: Task) {
|
export function complete(config: Config, profile: string, task: Task) {
|
||||||
const profileConfig = config.profiles[profile];
|
const profileConfig = config.profiles[profile];
|
||||||
@@ -26,7 +27,8 @@ export function complete(config: Config, profile: string, task: Task) {
|
|||||||
throw new Error(`Cannot complete task, file has been changed since last scan. Rememberred line: ${task.source}, current line: ${line}.`);
|
throw new Error(`Cannot complete task, file has been changed since last scan. Rememberred line: ${task.source}, current line: ${line}.`);
|
||||||
}
|
}
|
||||||
|
|
||||||
output.push(line.replace(/^-(\s+)\[.\]/, `-$1[${profileConfig.completion?.status ?? 'x'}]`));
|
const taskStr = line.replace(/^-(\s+)\[.\]/, `-$1[${profileConfig.completion?.status ?? 'x'}]`);
|
||||||
|
output.push(`${taskStr} ✅ ${dayjs().format("YYYY-MM-DD")}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
else {
|
else {
|
||||||
|
|||||||
Reference in New Issue
Block a user