summaryrefslogtreecommitdiff
path: root/headers.lua
blob: 87266151e870150332cbb1dbf8f9e5202c8d7701 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/usr/bin/env lua
local args = require "pl.lapp" [[
Prints list of headers from a standard or available standards
	-d  (string default 'db/')      Directory where definitions are placed
	<selection>  (optional string)  Standard to display headers for
]]
local dir = require "pl.dir"
local parser = require "headers.parser".new()
local definitions = dir.getfiles(args.d, "*.lua")
for _, filename in pairs(definitions) do
	local handle = io.open(filename)
	local data = handle:read("a")
	handle:close()
	if parser:parse(data, args.selection) then
		return  -- interface is yet to be properly defined, this allows only for first-result queries
	end
end