Name: luvit-options
Owner: racker
Description: easy to use getopt library for luvit
Created: 2012-03-07 18:08:44.0
Updated: 2015-02-20 02:45:32.0
Pushed: 2015-02-20 02:45:32.0
Size: 106
Language: Lua
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
This module implements an easy to use getopt library for luvit.
luvit-options is inspired in node-optimist module
https://github.com/substack/node-optimist
Based on lua's getopt
http://lua-users.org/wiki/AlternativeGetOpt
#!/usr/bin/env luvit
local opt = require ("options")
:usage ("Usage: ./test.lua [-hk] [-a arg] [-b arg]")
:default ("a", "patata")
:describe ("a", "set an argument to this flag")
:describe ("b", "set b flag")
:describe ("k", "kakaka")
:describe ("h", "showHelp")
:alias ( {["a"]="arg"})
:demand ({"a", "k"})
:check(function(opt)
return opt.b
end)
:argv ("ha:b:k")
p(opt)