Compare commits

..

2 Commits

2 changed files with 10 additions and 3 deletions

View File

@@ -10,6 +10,7 @@ and has only been superficially tested. It should be considered experimental and
import fs from 'node:fs';
import { stat } from 'node:fs/promises';
import { inspect } from 'node:util';
const lineRe = /^\x1b\[35m\x1b\[K(.*?)\x1b/;
@@ -35,7 +36,7 @@ async function getMtime(line) {
return 0;
}
} 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); });
});
const lines = input.split(/(?<=\n)/);
const lines = input.split(/(?<=\n)/).filter(line => line.trim().length > 0);
const pairs = await Promise.all(
lines.map(async (line, index) => {

View File

@@ -2,7 +2,13 @@
*Here is an example for `jg` (javascript grep):*
```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