2021-06-07 06:16:00 -06:00
|
|
|
local _ENV = mkmodule('plugins.tiletypes')
|
|
|
|
|
2021-07-03 17:19:42 -06:00
|
|
|
local argparse = require('argparse')
|
2021-06-07 06:16:00 -06:00
|
|
|
local utils = require('utils')
|
|
|
|
|
|
|
|
local function parse_cursor(opts, arg)
|
2021-07-03 17:19:42 -06:00
|
|
|
utils.assign(opt.cursor, argparse.coords(arg))
|
2021-06-07 06:16:00 -06:00
|
|
|
end
|
|
|
|
|
|
|
|
function parse_commandline(opts, ...)
|
2021-07-03 17:19:42 -06:00
|
|
|
local positionals = argparse.processArgsGetopt({...}, {
|
2021-06-07 06:16:00 -06:00
|
|
|
{'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
|