summaryrefslogtreecommitdiff
path: root/nvim/convert-to-fennel.nu
blob: 67a98869948364e82a952ab39d201e750d2d4ceb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
def find-luas [dir] {
  ls $dir | where name ends-with .lua | where type == "file" | get name 
}

let luas = find-luas . | append (find-luas ./lua) | append (find-luas ./lua/plugins/) | append (find-luas ./lua/config)

$luas | each {|lua|
  let fnl = $lua | str replace "lua\/" "fnl\/" | str replace ".lua" ".fnl"
  try { 
    let filename = ls $fnl | get "name" 
    [$filename.0, " already converted"] | str join 
  } catch {
    antifennel $lua | save $fnl
    [$fnl, " now converted! ✅"] | str join
  }
}