Skip to content

Commit 77324c5

Browse files
committed
drops commented code related to watch mode
1 parent c6d437f commit 77324c5

File tree

3 files changed

+5
-60
lines changed

3 files changed

+5
-60
lines changed

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ npm i -g taskparser
4747

4848
```
4949
$ taskparser -h
50-
usage: taskparser [-h] [-t TAGS] [-f FILTER] [-s SORT] [-w] [-l] [-C] [-U] [-o {table,csv,json}] [-c COLUMNS]
50+
usage: taskparser [-h] [-t TAGS] [-f FILTER] [-s SORT] [-l] [-C] [-U] [-o {table,csv,json}] [-c COLUMNS]
5151
[-v] [--today] [--title TITLE]
5252
path
5353
@@ -63,7 +63,6 @@ optional arguments:
6363
-f FILTER, --filter FILTER
6464
filtering expression such as: foo(=bar)
6565
-s SORT, --sort SORT sorting expression such as: foo(asc)
66-
-w, --watch enable watch mode
6766
-l, --worklogs enable worklogs mode
6867
-C, --checked only show checked tasks
6968
-U, --unchecked only show unchecked tasks

src/bin.ts

Lines changed: 3 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { writeFile } from 'node:fs/promises';
1010

1111
import { ArgumentParser } from 'argparse';
1212

13-
import { parseFolder /*, watchFolder */ } from './parse.js';
13+
import { parseFolder } from './parse.js';
1414
import { renderCSV } from './renderers/csv.js';
1515
import { renderJSON } from './renderers/json.js';
1616
import { renderTabular } from './renderers/table.js';
@@ -49,12 +49,6 @@ arg_parser.add_argument('-s', '--sort', {
4949
help: 'sorting expression such as: foo(asc)'
5050
});
5151

52-
arg_parser.add_argument('-w', '--watch', {
53-
required: false,
54-
action: 'store_true',
55-
help: 'enable watch mode'
56-
});
57-
5852
arg_parser.add_argument('-l', '--worklogs', {
5953
required: false,
6054
action: 'store_true',
@@ -211,19 +205,5 @@ const renderItems = (items: Set<Item>) => {
211205
// 3.. 2.. 1.. LET'S GO!
212206
// ============================================================================
213207

214-
if (cli_args.watch) {
215-
throw new Error('watch mode is temporarily disabled');
216-
/*
217-
const { stdout } = process;
218-
if (!stdout.isTTY) {
219-
throw new Error('cannot use -w/--watch if the terminal is not a TTY');
220-
}
221-
for await (const { tasks, worklogs } of watchFolder(folder_path)) {
222-
stdout.write('\x1bc');
223-
renderItems(cli_args.worklogs ? worklogs : tasks);
224-
}
225-
*/
226-
} else {
227-
const { tasks, worklogs } = await parseFolder(folder_path);
228-
renderItems(cli_args.worklogs ? worklogs : tasks);
229-
}
208+
const { tasks, worklogs } = await parseFolder(folder_path);
209+
renderItems(cli_args.worklogs ? worklogs : tasks);

src/parse.ts

Lines changed: 1 addition & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import type { Parent, Node, Yaml, ListItem, Text, Heading } from 'mdast';
33
import type { TagMap, Task, Worklog, ParseContext, ParseFileContext, InternalTagMap, ParsedHeading } from './types.js';
44

5-
import { readdir, readFile, watch, stat } from 'node:fs/promises';
5+
import { readdir, readFile, stat } from 'node:fs/promises';
66
import { resolve, relative } from 'node:path';
77

88
import { load } from 'js-yaml';
@@ -219,37 +219,3 @@ export const parseFolder = async (folder_path: string): Promise<ParseContext> =>
219219
await parseFolderHelper(ctx, folder_path);
220220
return ctx;
221221
};
222-
223-
// export async function* watchFolder(folder_path: string): AsyncIterable<ParseContext> {
224-
// const ctx: ParseContext = {
225-
// folder: folder_path,
226-
// tasks: new Set(),
227-
// worklogs: new Set(),
228-
// tags: {},
229-
// internal_tags: {},
230-
// };
231-
// await parseFolderHelper(ctx, folder_path);
232-
// yield ctx;
233-
// for await (const evt of watch(ctx.folder)) {
234-
235-
// if (evt.filename === FOLDER_META_FILE) {
236-
237-
// }
238-
239-
// if (evt.filename?.endsWith('.md') || evt.filename === FOLDER_META_FILE) {
240-
// const file_path = resolve(ctx.folder, evt.filename);
241-
// switch (evt.eventType) {
242-
// case 'change':
243-
// case 'rename':
244-
// await parseFile({
245-
// ...ctx,
246-
// file: file_path,
247-
// internal_tags: { file: evt.filename },
248-
// tags: {},
249-
// });
250-
// yield ctx;
251-
// break;
252-
// }
253-
// }
254-
// }
255-
// };

0 commit comments

Comments
 (0)