UNPKG

todo-txt-cli

Version:

A CLI for todo.txt files - http://todotxt.org/

147 lines (146 loc) 3.76 kB
export class Task { /** * @param {string} raw * @param {string} [id] * @returns {Task} */ static parse(raw: string, id?: string): Task; /** * @param {object} json * @param {string} [id] * @returns {Task} */ static fromJson(json: object, id?: string): Task; /** * @see https://github.com/todotxt/todo.txt * @param {string} raw * @param {string} [id] */ constructor(raw: string, id?: string); isCompleted: boolean; /** @type {string|undefined} */ priority: string | undefined; /** @type {Set<string>} */ projects: Set<string>; /** @type {Set<string>} */ contexts: Set<string>; /** @type {Map<string, Set<string>>} */ fields: Map<string, Set<string>>; /** @type {Date|undefined} */ createdAt: Date | undefined; /** @type {Date|undefined} */ dueAt: Date | undefined; /** @type {Date|undefined} */ completedAt: Date | undefined; /** @type {string} */ task: string; /** @type {{type: string, value: string, key?: string}[]} */ tokens: { type: string; value: string; key?: string; }[]; id: string | undefined; set raw(raw: string); get raw(): string; _clear(): void; /** * @param {string} raw */ update(raw: string): void; /** * mark task as completed. If `flag==false` task is "undone" * @param {boolean} flag */ complete(flag?: boolean): void; prioritize(priority: any): void; /** * @private * @param {string} key * @param {string} value */ private _setField; /** * @param {string} key * @param {string} value */ setField(key: string, value?: string): void; /** * Delete field value. If value == `null` then key with all values is deleted * @param {string} key * @param {string|undefined} value * @returns {boolean} */ deleteField(key: string, value?: string | undefined): boolean; /** * @param {Date|undefined} date */ due(date: Date | undefined): void; /** * output as todo.txt line * @param {StringifyOptions} [options] * @returns {string} */ stringify(options?: StringifyOptions): string; /** * output as JSON object * @returns {JTask} */ toJSON(): JTask; } export type Colors = import("#colors.js").Colors; export type JTask = { id?: string; isCompleted: boolean; priority?: string; projects?: string[]; contexts?: string[]; fields?: Record<string, string[]>; createdAt?: string | Date; dueAt?: string | Date; completedAt?: string | Date; task?: string; }; export type StringifyOptions = { /** * sorting: 0 = none, 1 = ascending */ sortTask?: number | undefined; /** * ordering: 0 = normal, 1 = dueDate, project, * context before task description */ orderTask?: number | undefined; /** * show task index num chars wide */ showIndex?: number | undefined; /** * hide project names */ hideProjects?: boolean | undefined; /** * hide context names */ hideContexts?: boolean | undefined; /** * hide createdAt timestamp names */ hideCreatedAt?: boolean | undefined; /** * colors for displaying tasks */ colors?: import("#colors.js").Colors | undefined; }; export type TaskOptions = { /** * sorting for projects, contexts, fields: 0 == * none, 1 = ascending */ sortTask?: number | undefined; /** * order for stringify(): 0 == normal, 1 == if * tasks are longer dueDate, projects, contexts before task description */ orderTask?: number | undefined; };