wiki updated
This commit is contained in:
parent
0727ed40e3
commit
98bb2dc5ef
2 changed files with 13 additions and 2 deletions
13
helpers.lua
13
helpers.lua
|
@ -106,7 +106,7 @@ end
|
||||||
|
|
||||||
-- {{{ Pipe operations
|
-- {{{ Pipe operations
|
||||||
|
|
||||||
-- read the full output of a pipe (command)
|
-- read the full output of a command output
|
||||||
function helpers.read_pipe(cmd)
|
function helpers.read_pipe(cmd)
|
||||||
local f = assert(io.popen(cmd))
|
local f = assert(io.popen(cmd))
|
||||||
local output = f:read("*all")
|
local output = f:read("*all")
|
||||||
|
@ -114,6 +114,16 @@ function helpers.read_pipe(cmd)
|
||||||
return output
|
return output
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- return line iterator of a command output
|
||||||
|
function helpers.pipelines(...)
|
||||||
|
local f = assert(io.popen(...))
|
||||||
|
return function () -- iterator
|
||||||
|
local data = f:read()
|
||||||
|
if data == nil then f:close() end
|
||||||
|
return data
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
-- }}}
|
-- }}}
|
||||||
|
|
||||||
-- {{{ A map utility
|
-- {{{ A map utility
|
||||||
|
@ -149,4 +159,5 @@ function helpers.spairs(t)
|
||||||
end
|
end
|
||||||
--}}}
|
--}}}
|
||||||
|
|
||||||
|
|
||||||
return helpers
|
return helpers
|
||||||
|
|
2
wiki
2
wiki
|
@ -1 +1 @@
|
||||||
Subproject commit ecd1b96ca46ea4ca66e36acb62156ebe979e639d
|
Subproject commit 2dced03d48556fedc7113ea619efe686d92cc7fc
|
Loading…
Add table
Reference in a new issue