return Parser as the module

This commit is contained in:
mpeterv
2014-02-17 18:41:09 +04:00
parent 3788b9c1a6
commit ccad58ef50
12 changed files with 109 additions and 117 deletions

View File

@@ -1,5 +1,3 @@
local argparse = {}
local class = require "30log"
local Declarative = {}
@@ -637,11 +635,7 @@ function Parser:parse(args)
end
local function get_option(name)
if opt_context[name] then
return opt_context[name]
else
parser:error("unknown option '%s'%s", name, get_tip(opt_context, name))
end
return parser:assert(opt_context[name], "unknown option '%s'%s", name, get_tip(opt_context, name))
end
local function handle_argument(data)
@@ -758,6 +752,4 @@ function Parser:parse(args)
return result
end
argparse.parser = Parser
return argparse
return Parser