在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):mpeterv/argparse开源软件地址(OpenSource Url):https://github.com/mpeterv/argparse开源编程语言(OpenSource Language):Lua 93.4%开源软件介绍(OpenSource Introduction):argparseArgparse is a feature-rich command line parser for Lua inspired by argparse for Python. Argparse supports positional arguments, options, flags, optional arguments, subcommands and more. Argparse automatically generates usage, help and error messages. ContentsExampleSimple example: -- script.lua
local argparse = require "argparse"
local parser = argparse("script", "An example.")
parser:argument("input", "Input file.")
parser:option("-o --output", "Output file.", "a.out")
parser:option("-I --include", "Include locations."):count("*")
local args = parser:parse()
$ lua script.lua foo {
input = "foo",
output = "a.out",
include = {}
} $ lua script.lua foo -I/usr/local/include -Isrc -o bar {
input = "foo",
output = "bar",
include = {"/usr/local/include", "src"}
} Error messages depending on command line arguments: $ lua script.lua foo bar
$ lua script.lua --help
$ lua script.lua foo --outptu=bar
InstallationUsing LuaRocksInstalling argparse using LuaRocks is simple: $ luarocks install argparse Without LuaRocksDownload TutorialThe tutorial is available online. If argparse has been installed using LuaRocks 2.1.2 or later, it can be viewed using Tutorial HTML files can be built using Sphinx: Testingargparse comes with a testing suite located in Licenseargparse is licensed under the same terms as Lua itself (MIT license). |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论