소스 검색

documentation of a sort

pull/1/head
XeonSquared 5 년 전
부모
커밋
95e6a18216
2개의 변경된 파일34개의 추가작업 그리고 1개의 파일을 삭제
  1. +7
    -1
      README.md
  2. +27
    -0
      finddesc.lua

+ 7
- 1
README.md 파일 보기

@@ -1,3 +1,9 @@
# OC-PsychOS2

Operating system for OpenComputers
A lightweight, multi-user operating system for OpenComputers

## Documentation

To generate function documentation, run:

./finddesc.lua module/* lib/* > apidoc.md

+ 27
- 0
finddesc.lua 파일 보기

@@ -0,0 +1,27 @@
local tA = {...}
local docfiles = {}
for _,file in pairs(tA) do
docfiles[file] = {}
local f = io.open(file)
local lines = {}
for l in f:read("*a"):gmatch("[^\n]+") do
if l:find("function") and not l:find("local") then
lines[#lines+1] = l
end
end
for k,v in pairs(lines) do
local name, args, desc = v:match("function%s+(.+)%s*%((.*)%)%s*%-%-%s*(.+)")
if name and args and desc then
docfiles[file][#docfiles[file]+1] = string.format("##%s(%s)\n%s",name,args,desc)
end
end
end

for k,v in pairs(docfiles) do
if #v > 0 then
print("#"..k)
for l,m in pairs(v) do
print(m)
end
end
end

불러오는 중...
취소
저장