UNPKG

todo-txt-cli

Version:

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

142 lines (141 loc) 3.77 kB
export class Tasks { /** * @param {string} [content] */ constructor(content?: string); _index: number; /** @type {Task[]} */ tasks: Task[]; getId(): string; /** * @private */ private _idFn; push(task: any): this; get length(): number; /** * add one or many tasks to tasks list * @param {string} content * @param {{timestamp?: boolean}} [options] * @returns {Tasks|undefined} */ add(content?: string, options?: { timestamp?: boolean; }): Tasks | undefined; /** * deletes task with id. If `term` is given then only term is removed from the * task * @param {string} id * @param {string} [term] * @returns {Task|undefined} */ remove(id: string, term?: string): Task | undefined; /** * append `term` to task with `id` * @param {string} id * @param {string} term * @returns {Task|undefined} */ append(id: string, term?: string): Task | undefined; /** * prepend `term` to task with `id` * @param {string} id * @param {string} term * @returns {Task|undefined} */ prepend(id: string, term: string): Task | undefined; replace(id: any, content: any): Task | undefined; /** * @param {string[]} ids * @returns {Tasks} */ done(ids: string[]): Tasks; /** * @param {string[]} ids * @param {string} dateStr iso-date YYYY-MM-DD or relative-date +1month2weeks3days (1m2w3d) * @returns {Tasks|undefined} */ due(ids: string[], dateStr: string): Tasks | undefined; /** * correct overdue tasks * @param {string} dateStr iso-date YYYY-MM-DD or relative-date +1month2weeks3days (1m2w3d) * @returns {Tasks|undefined} */ overdue(dateStr?: string): Tasks | undefined; /** * @param {string[]} ids * @param {string} [priority] * @return {Tasks} */ prioritize(ids: string[], priority?: string): Tasks; /** * @param {string[]} ids * @return {Tasks} */ dePrioritize(ids: string[]): Tasks; /** * archive completed tasks * @return {Tasks} */ archive(): Tasks; /** * list (filter) tasks according to terms * @param {(string|RegExp)[]} [terms] * @param {{ * priorities?: string * onlyProjects?: boolean * onlyContexts?: boolean * showCompleted?: boolean * }} [options] * @return {Tasks} */ list(terms?: (string | RegExp)[], options?: { priorities?: string; onlyProjects?: boolean; onlyContexts?: boolean; showCompleted?: boolean; }): Tasks; /** * @param {string} id * @returns {{index: number, task?: Task}} */ findIndex(id: string): { index: number; task?: Task; }; /** * sort task list by sort order * @param {string[]} [sortOrder] * @returns {this} */ sortBy(sortOrder?: string[]): this; /** * sort task projects and contexts * @param {TaskSortOrder} taskSortOrder * @returns {this} */ sortTaskContent(taskSortOrder: TaskSortOrder): this; /** * reverse task list sort order * @returns {this} */ reverse(): this; /** * @param {TaskSortOrder & {reverse?: boolean}} [options] * @returns {string} */ stringify(options?: TaskSortOrder & { reverse?: boolean; }): string; /** * @param {string[]} ids * @returns {Tasks} */ undo(ids: string[]): Tasks; } export type StringifyOptions = import("#task.js").StringifyOptions; export type TaskLimit = { limit?: number; }; export type TaskSortOrder = StringifyOptions & TaskLimit; import { Task } from '#task.js';