aboutsummaryrefslogtreecommitdiff
path: root/scripts/apply_vimgrep_updates.js
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/apply_vimgrep_updates.js')
-rwxr-xr-xscripts/apply_vimgrep_updates.js29
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`)
-