Add optional root argument to find file command

This commit is contained in:
Talia 2023-07-04 10:57:04 +02:00
parent b0b3b7e36c
commit a3d6402017

View file

@ -1,9 +1,16 @@
#!/usr/bin/env lua
local arrr = require 'arrr'
local params = arrr {
{ "Sets the root to search in", "--root", "-r", 'root' };
}{...}
local buf = {}
for _, argument in ipairs{...} do
local root = params.root or "."
for _, argument in ipairs(params) do
table.insert(buf, "-name '"..argument:gsub("'", [['"'"']]).."'")
end
os.execute("find . " .. table.concat(buf, " -or "))
os.execute("find "..root.." " .. table.concat(buf, " -or "))