aboutsummaryrefslogtreecommitdiff
path: root/scripts/apply_vimgrep_updates.fnl
diff options
context:
space:
mode:
authorAkshay Nair <phenax5@gmail.com>2026-06-23 00:50:21 +0530
committerAkshay Nair <phenax5@gmail.com>2026-06-23 00:50:21 +0530
commit7502d1e84ae9956356e1578f65d11a8326ce3ec0 (patch)
treed5f9140d2e4ffcd57df971b2b27dc655b7a6294c /scripts/apply_vimgrep_updates.fnl
parente254ac67272707644be53aa1eb296917651a1771 (diff)
downloadkakoune-config-7502d1e84ae9956356e1578f65d11a8326ce3ec0.tar.gz
kakoune-config-7502d1e84ae9956356e1578f65d11a8326ce3ec0.zip
Refactor fennel scripts to babashka clojure
Diffstat (limited to 'scripts/apply_vimgrep_updates.fnl')
-rwxr-xr-xscripts/apply_vimgrep_updates.fnl43
1 files changed, 0 insertions, 43 deletions
diff --git a/scripts/apply_vimgrep_updates.fnl b/scripts/apply_vimgrep_updates.fnl
deleted file mode 100755
index 5fada6c..0000000
--- a/scripts/apply_vimgrep_updates.fnl
+++ /dev/null
@@ -1,43 +0,0 @@
-#!/usr/bin/env -S fennel --lua luajit
-
-;; TODO: Support -A -B outputs for context
-
-(local M {})
-
-(fn M.main []
- (local write-count (M.apply-vimgrep-changes))
- (print (.. "Applied " write-count " changes")))
-
-(fn M.apply-vimgrep-changes []
- (var count 0)
- (each [line (io.lines)]
- (local (filepath linenr _ text) (M.parse-vimgrep line))
- (when filepath
- (local applied? (M.update-line filepath linenr text))
- (when applied?
- (set count (+ count 1)))))
- count)
-
-(fn M.parse-vimgrep [line]
- (local (filepath linenr col text) (string.match line "(.*):(%d+):(%d+):(.*)"))
- (values filepath (tonumber linenr) col text))
-
-(fn M.update-line [filepath linenr text]
- (local lines (M.read-lines filepath))
- (var written? false)
- (when (and (> (length lines) linenr) (not= (. lines linenr) text))
- (set (. lines linenr) text)
- (local file (io.open filepath :w))
- (file:write (.. (table.concat lines "\n") "\n"))
- (file:close)
- (set written? true))
- written?)
-
-(fn M.read-lines [filepath]
- (local file (io.open filepath :r))
- (local lines [])
- (each [line (file:lines)] (table.insert lines line))
- (file:close)
- lines)
-
-(M.main)