Skip to content

Commit 75a7656

Browse files
committed
0.4.0 release
1 parent 389d5e0 commit 75a7656

File tree

2 files changed

+55
-33
lines changed

2 files changed

+55
-33
lines changed

README.md

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -2,55 +2,55 @@
22

33
[![Build Status](https://travis-ci.org/mpeterv/argparse.png?branch=master)](https://travis-ci.org/mpeterv/argparse)
44

5-
argparse is a feature-rich command line parser for Lua inspired by argparse for Python.
5+
Argparse is a feature-rich command line parser for Lua inspired by argparse for Python.
66

7-
argparse supports positional arguments, options, flags, optional arguments, subcommands and more. argparse automatically generates usage, help and error messages.
7+
Argparse supports positional arguments, options, flags, optional arguments, subcommands and more. Argparse automatically generates usage, help and error messages.
88

9-
Quick glance:
9+
Simple example:
1010

1111
```lua
1212
-- script.lua
1313
local argparse = require "argparse"
14-
local parser = argparse()
15-
:description "An example."
16-
parser:argument "input"
17-
:description "Input file."
18-
parser:option "-o" "--output"
19-
:default "a.out"
20-
:description "Output file."
21-
parser:option "-I" "--include"
22-
:count "*"
23-
:description "Include locations."
14+
15+
local parser = argparse("script", "An example.")
16+
parser:argument("input", "Input file.")
17+
parser:option("-o --output", "Output file.", "a.out")
18+
parser:option("-I --include", "Include locations."):count("*")
19+
2420
local args = parser:parse()
25-
prettyprint(args)
21+
print(args) -- Assuming print is patched to handle tables nicely.
2622
```
2723

2824
```bash
2925
$ lua script.lua foo
3026
```
3127

32-
```
33-
input: foo
34-
output: a.out
35-
include: {}
28+
```lua
29+
{
30+
input = "foo",
31+
output = "a.out",
32+
include = {}
33+
}
3634
```
3735

3836
```bash
39-
$ lua script.lua foo -I/usr/local/include -I/src -o bar
37+
$ lua script.lua foo -I/usr/local/include -Isrc -o bar
4038
```
4139

42-
```
43-
input: foo
44-
output: bar
45-
include: {/usr/local/include, /src}
40+
```lua
41+
{
42+
input = "foo",
43+
output = "bar",
44+
include = {"/usr/local/include", "src"}
45+
}
4646
```
4747

4848
```bash
4949
$ lua script.lua foo bar
5050
```
5151

5252
```
53-
Usage: script.lua [-o <output>] [-I <include>] [-h] <input>
53+
Usage: script [-o <output>] [-I <include>] [-h] <input>
5454
5555
Error: too many arguments
5656
```
@@ -60,7 +60,7 @@ $ lua script.lua --help
6060
```
6161

6262
```
63-
Usage: script.lua [-o <output>] [-I <include>] [-h] <input>
63+
Usage: script [-o <output>] [-I <include>] [-h] <input>
6464
6565
An example.
6666
@@ -80,7 +80,7 @@ $ lua script.lua foo --outptu=bar
8080
```
8181

8282
```
83-
Usage: script.lua [-o <output>] [-I <include>] [-h] <input>
83+
Usage: script [-o <output>] [-I <include>] [-h] <input>
8484
8585
Error: unknown option '--outptu'
8686
Did you mean '--output'?
@@ -95,26 +95,26 @@ Did you mean '--output'?
9595

9696
## Installation
9797

98-
### Using luarocks
98+
### Using LuaRocks
9999

100-
Installing argparse using luarocks is simple.
100+
Installing argparse using [LuaRocks](http://luarocks.org) is simple:
101101

102102
```bash
103103
$ luarocks install argparse
104104
```
105105

106-
### Without luarocks
106+
### Without LuaRocks
107107

108-
Download `src/argparse.lua` file and put it into the directory for Lua libraries or your working directory.
108+
Download `src/argparse.lua` file and put it into the directory for Lua libraries or your working directory.
109109

110110
## Tutorial
111111

112-
The tutorial is available [online](http://mpeterv.github.io/argparse/) and in the `doc` directory. If argparse was installed using luarocks 2.1.2 or later, it can be viewed using `luarocks doc argparse` command.
112+
The tutorial is available [online](http://argparse.readthedocs.org) and in the `doc` directory. If argparse has been installed using LuaRocks 2.1.2 or later, it can be viewed using `luarocks doc argparse` command.
113113

114114
## Testing
115115

116-
argparse comes with a testing suite located in `spec` directory. [busted](http://olivinelabs.com/busted/) is required for testing, it can be installed using luarocks. Run the tests using `busted spec` command from the argparse folder.
116+
argparse comes with a testing suite located in `spec` directory. [busted](http://olivinelabs.com/busted/) is required for testing, it can be installed using LuaRocks. Run the tests using `busted spec` command from the argparse folder.
117117

118118
## License
119119

120-
argparse is licensed under the same terms as Lua itself(MIT license).
120+
argparse is licensed under the same terms as Lua itself (MIT license).

rockspecs/argparse-0.4.0-1.rockspec

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
package = "argparse"
2+
version = "0.4.0-1"
3+
source = {
4+
url = "git://github.com/mpeterv/argparse",
5+
tag = "0.4.0"
6+
}
7+
description = {
8+
summary = "A feature-rich command-line argument parser",
9+
detailed = "Argparse supports positional arguments, options, flags, optional arguments, subcommands and more. Argparse automatically generates usage, help and error messages.",
10+
homepage = "https://github.com/mpeterv/argparse",
11+
license = "MIT/X11"
12+
}
13+
dependencies = {
14+
"lua >= 5.1, < 5.4"
15+
}
16+
build = {
17+
type = "builtin",
18+
modules = {
19+
argparse = "src/argparse.lua"
20+
},
21+
copy_directories = {"doc", "spec"}
22+
}

0 commit comments

Comments
 (0)