Compare commits
9 Commits
cb5de6948f
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 097b6d70fb | |||
| a4142b7dcd | |||
| 7b25ce9755 | |||
| 2e5a7978b1 | |||
| e80ea341e6 | |||
| 61842e61b1 | |||
| 2f1044637e | |||
| 180313b47d | |||
| 57c654a220 |
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
package-lock.json
|
||||||
1
.npmignore
Normal file
1
.npmignore
Normal file
@@ -0,0 +1 @@
|
|||||||
|
package-lock.json
|
||||||
2
ansi-tunc.mjs → ansi-trunc.mjs
Normal file → Executable file
2
ansi-tunc.mjs → ansi-trunc.mjs
Normal file → Executable file
@@ -1,3 +1,5 @@
|
|||||||
|
#!/usr/bin/env node
|
||||||
|
|
||||||
/* VIBE ALERT
|
/* VIBE ALERT
|
||||||
|
|
||||||
This code was generated using OpenAI’s ChatGPT (GPT-5.2 Thinking, large language model).
|
This code was generated using OpenAI’s ChatGPT (GPT-5.2 Thinking, large language model).
|
||||||
9
grep-mtime-sorter.mjs
Normal file → Executable file
9
grep-mtime-sorter.mjs
Normal file → Executable file
@@ -1,6 +1,8 @@
|
|||||||
|
#!/usr/bin/env node
|
||||||
|
|
||||||
/* VIBE ALERT
|
/* VIBE ALERT
|
||||||
|
|
||||||
This code was generated using OpenAI’s 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.
|
||||||
|
|
||||||
@@ -8,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/;
|
||||||
|
|
||||||
@@ -33,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)}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -45,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) => {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "ansi-tools",
|
"name": "efforting-shell-utils",
|
||||||
"version": "0.1.0",
|
"version": "0.1.2",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"private": true,
|
"private": true,
|
||||||
"bin": {
|
"bin": {
|
||||||
|
|||||||
30
readme.md
Normal file
30
readme.md
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
## Usage
|
||||||
|
|
||||||
|
*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
|
||||||
|
```
|
||||||
|
|
||||||
|
## Global Installation
|
||||||
|
|
||||||
|
### HTTPS
|
||||||
|
|
||||||
|
```sh
|
||||||
|
sudo npm install -g 'git+https://gitea.efforting.tech/mikael-lovqvist/shell-utils.git#latest'
|
||||||
|
```
|
||||||
|
|
||||||
|
### SSH
|
||||||
|
|
||||||
|
> [!CAUTION]
|
||||||
|
> When you run `npm` as sudo, it will not use your users git configuration or identity. For now HTTPS is recommended instead.
|
||||||
|
|
||||||
|
|
||||||
|
```sh
|
||||||
|
sudo npm install -g 'git+ssh://git.efforting.tech:mikael-lovqvist/shell-utils.git#latest'
|
||||||
|
```
|
||||||
Reference in New Issue
Block a user