Add optional root argument to find file command
This commit is contained in:
parent
b0b3b7e36c
commit
a3d6402017
1 changed files with 9 additions and 2 deletions
|
@ -1,9 +1,16 @@
|
||||||
#!/usr/bin/env lua
|
#!/usr/bin/env lua
|
||||||
|
|
||||||
|
local arrr = require 'arrr'
|
||||||
|
local params = arrr {
|
||||||
|
{ "Sets the root to search in", "--root", "-r", 'root' };
|
||||||
|
}{...}
|
||||||
|
|
||||||
local buf = {}
|
local buf = {}
|
||||||
|
|
||||||
for _, argument in ipairs{...} do
|
local root = params.root or "."
|
||||||
|
|
||||||
|
for _, argument in ipairs(params) do
|
||||||
table.insert(buf, "-name '"..argument:gsub("'", [['"'"']]).."'")
|
table.insert(buf, "-name '"..argument:gsub("'", [['"'"']]).."'")
|
||||||
end
|
end
|
||||||
|
|
||||||
os.execute("find . " .. table.concat(buf, " -or "))
|
os.execute("find "..root.." " .. table.concat(buf, " -or "))
|
||||||
|
|
Loading…
Reference in a new issue