dfhack/plugins/lua/tiletypes.lua

24 lines
675 B
Lua

local _ENV = mkmodule('plugins.tiletypes')
2021-07-03 17:19:42 -06:00
local argparse = require('argparse')
local utils = require('utils')
local function parse_cursor(opts, arg)
2021-07-03 17:21:43 -06:00
utils.assign(opts.cursor, argparse.coords(arg))
end
function parse_commandline(opts, ...)
2021-07-03 17:19:42 -06:00
local positionals = argparse.processArgsGetopt({...}, {
{'c', 'cursor', hasArg=true,
handler=function(arg) parse_cursor(opts, arg) end},
{'h', 'help', handler=function() opts.help = true end},
{'q', 'quiet', handler=function() opts.quiet = true end},
})
if positionals[1] == 'help' or positionals[1] == '?' then
opts.help = true
end
end
return _ENV