tArgs = { ... }
if #tArgs > 0 then
	sTopic = tArgs[1]
else
	sTopic = "intro"
end

if sTopic == "index" then
	print( "Help topics availiable:" )
	local tTopics = help.topics()
	textutils.pagedTabulate( tTopics )
	return
end
	
local w,h = term.getSize()
local sFile = help.lookup( sTopic )
local file = ((sFile ~= nil) and io.open( sFile )) or nil
local nLinesPrinted = 0
if file then
	local sLine = file:read()
	local nLines = 0
	while sLine do
    	nLinesPrinted = nLinesPrinted + print( sLine )
    	sLine = file:read()
    	if sLine and nLinesPrinted >= h - 2 then
    		term.write( "Press any key to continue" )
    		os.pullEvent( "key" )
    		term.clearLine()
    		term.setCursorPos(1,h)
    	end
    end
	file:close()
else
	print( "No help available" )
end
