diff options
| author | Akshay Nair <phenax5@gmail.com> | 2025-10-14 09:53:33 +0530 |
|---|---|---|
| committer | Akshay Nair <phenax5@gmail.com> | 2025-10-21 13:39:45 +0530 |
| commit | 94bb19748d3bb8636cf252539b8f0be18f46515a (patch) | |
| tree | 8029e727bd4a8d2a1282cd9b08b9cf8d6c3e72ce /scripts/apply_vimgrep_updates.js | |
| parent | 2fa61e7942d899c7d883d3f5a82e7623740ebb6b (diff) | |
| download | kakoune-config-94bb19748d3bb8636cf252539b8f0be18f46515a.tar.gz kakoune-config-94bb19748d3bb8636cf252539b8f0be18f46515a.zip | |
Switch grep update script to fnl
Diffstat (limited to '')
| -rwxr-xr-x | scripts/apply_vimgrep_updates.js | 29 |
1 files changed, 0 insertions, 29 deletions
diff --git a/scripts/apply_vimgrep_updates.js b/scripts/apply_vimgrep_updates.js deleted file mode 100755 index 9707aab..0000000 --- a/scripts/apply_vimgrep_updates.js +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/env bun - -const main = async () => { - let count = 0 - for await (const line of console) { - const [_, filepath, row, _col, text] = line.match(/(.*):(\d+):(\d+):(.*)/) ?? [] - if (filepath) { - const isApplied = await apply_edit(filepath, Number(row), text); - if (isApplied) count++ - } - } - return count -} - -const apply_edit = async (filepath, row, text) => { - if (!Number.isFinite(row) || row <= 0) return false; - const file = Bun.file(filepath) - const lines = (await file.text()).split('\n') - if (lines.length > row) { - lines[row - 1] = text - await Bun.write(filepath, lines.join('\n')) - return true - } - return false -} - -const changesCount = await main() -console.log(`Applied ${changesCount} changes`) - |
