4 Commits
latest ... main

2 changed files with 11 additions and 4 deletions

View File

@@ -2,7 +2,7 @@
/* VIBE ALERT /* VIBE ALERT
This code was generated using OpenAIs ChatGPT (GPT-5.2 Thinking, large language model). This code was generated using OpenAI's ChatGPT (GPT-5.2 Thinking, large language model).
The output has not been independently reviewed, audited, or comprehensively validated, The output has not been independently reviewed, audited, or comprehensively validated,
and has only been superficially tested. It should be considered experimental and not fully vetted for production use. and has only been superficially tested. It should be considered experimental and not fully vetted for production use.
@@ -10,6 +10,7 @@ and has only been superficially tested. It should be considered experimental and
import fs from 'node:fs'; import fs from 'node:fs';
import { stat } from 'node:fs/promises'; import { stat } from 'node:fs/promises';
import { inspect } from 'node:util';
const lineRe = /^\x1b\[35m\x1b\[K(.*?)\x1b/; const lineRe = /^\x1b\[35m\x1b\[K(.*?)\x1b/;
@@ -35,7 +36,7 @@ async function getMtime(line) {
return 0; return 0;
} }
} else { } else {
throw new Error('Malformed input: ANSI prefix not found'); throw new Error(`Malformed input: ANSI prefix not found for line ${inspect(line)}`);
} }
} }
@@ -47,7 +48,7 @@ async function main() {
process.stdin.on('end', () => { resolve(data); }); process.stdin.on('end', () => { resolve(data); });
}); });
const lines = input.split(/(?<=\n)/); const lines = input.split(/(?<=\n)/).filter(line => line.trim().length > 0);
const pairs = await Promise.all( const pairs = await Promise.all(
lines.map(async (line, index) => { lines.map(async (line, index) => {

View File

@@ -2,7 +2,13 @@
*Here is an example for `jg` (javascript grep):* *Here is an example for `jg` (javascript grep):*
```sh ```sh
grep --color=always -rin "$@" --include "*.js" --include "*.mjs" --exclude "*.min.js" --exclude-dir node_modules | grep-mtime-sorter | ansi-trunc -l 250 grep --color=always \
-rin "$@" \
--include "*.js" \
--include "*.mjs" \
--exclude "*.min.js" \
--exclude-dir node_modules \
| grep-mtime-sorter | ansi-trunc -l 250
``` ```
## Global Installation ## Global Installation