From 4b27f87fef2df2feaca47a8498f5f7f51e94b765 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Mon, 19 Feb 2024 18:43:32 +0100 Subject: fix(scripts): format-queries defaults to cwd --- scripts/format-queries.lua | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'scripts/format-queries.lua') diff --git a/scripts/format-queries.lua b/scripts/format-queries.lua index ab7aa237b..61309f817 100755 --- a/scripts/format-queries.lua +++ b/scripts/format-queries.lua @@ -6,13 +6,11 @@ local get_node_text = ts.get_node_text ---@type string[] local files -if not _G.arg[1] then - print "Must specify file or directory to format!" - return -elseif _G.arg[1]:match ".*%.scm$" then - files = { _G.arg[1] } +local arg = _G.arg[1] or "." +if arg:match ".*%.scm$" then + files = { arg } else - files = vim.fn.split(vim.fn.glob(_G.arg[1] .. "/**/*.scm")) + files = vim.fn.split(vim.fn.glob(arg .. "/**/*.scm")) end ts.query.add_predicate("has-type?", function(match, _, _, pred) -- cgit v1.2.3-70-g09d2