Skip to content

Commit add161b

Browse files
committed
cleanup README.md
1 parent 31e3220 commit add161b

File tree

1 file changed

+36
-31
lines changed

1 file changed

+36
-31
lines changed

README.md

Lines changed: 36 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -5,60 +5,63 @@ Golang implementation of [docopt](http://docopt.org/) 0.6.1+fix
55

66
## Installation
77

8-
import "github.com/kbatten/docopt.go" and then run `go get`
8+
import "github.com/kbatten/docopt.go" and then run `go get`.
99

1010
## API
1111

12+
*These may be updated because it seems like a cumbersome way to get around optional parameters*
1213

14+
``` go
15+
func docopt.Parse(doc string, argv []string, help bool, version string, optionsFirst bool)
16+
(args map[string]interface{}, output string, err error)
1317
```
14-
args, output, err := docopt.Parse(doc string, argv []string, help bool, version string, optionsFirst bool)
15-
1618
- parse and return a map of args, output and all errors
17-
```
1819

20+
``` go
21+
func docopt.ParseEasy(doc string)
22+
args map[string]interface{}
1923
```
20-
args := docopt.ParseEasy(doc string)
21-
2224
- parse just doc and return a map of args
2325
- handle all printing and non-fatal errors
2426
- panic on fatal errors
2527
- exit on user error or help
26-
```
27-
28-
```
29-
args, err := docopt.ParseQuiet(doc string, argv []string, help bool, version string, optionsFirst bool)
30-
31-
- parse and return a map of args and fatal errors
32-
- handle printing of help
33-
- exit on user error or help
34-
```
3528

29+
``` go
30+
func docopt.ParseLoud(doc string, argv []string, help bool, version string, optionsFirst bool)
31+
args map[string]interface{}
3632
```
37-
args := docopt.ParseLoud(doc string, argv []string, help bool, version string, optionsFirst bool)
3833

3934
- parse and return a map of args
4035
- handle all printing and non-fatal errors
4136
- panic on fatal errors
4237
- exit on user error or help
38+
39+
``` go
40+
func docopt.ParseQuiet(doc string, argv []string, help bool, version string, optionsFirst bool)
41+
(args map[string]interface{}, err error)
4342
```
4443

44+
- parse and return a map of args and fatal errors
45+
- handle printing of help
46+
- exit on user error or help
47+
4548
### arguments
4649

47-
`doc` usage string based on docopt language
50+
`doc`, usage string based on docopt language.
4851

49-
`argv` optional argument vector. set to `nil` to use os.Args
52+
`argv`, optional argument vector. set to `nil` to use os.Args.
5053

51-
`help` set to `true` to have docopt automatically handle `-h` and `--help`
54+
`help`, set to `true` to have docopt automatically handle `-h` and `--help`.
5255

53-
`version` set to a non-empty string that will automatically be shown with `--version`
56+
`version`, set to a non-empty string that will automatically be shown with `--version`.
5457

55-
`optionsFirst` set to `true` to disallow mixing options and positional arguments
58+
`optionsFirst`, set to `true` to disallow mixing options and positional arguments.
5659

5760
### return values
5861

59-
`args` map[string]interface{}. interface{} can be `bool`, `int`, `string`, `[]string`
62+
`args`, map[string]interface{}. interface{} can be `bool`, `int`, `string`, `[]string`.
6063

61-
`output` help output that would normally be displayed by the other `docopt.Parse*` functions.
64+
`output`, help output that would normally be displayed by the other `docopt.Parse*` functions.
6265

6366
`err`
6467

@@ -80,12 +83,12 @@ func main() {
8083
usage := `Naval Fate.
8184
8285
Usage:
83-
naval_fate.py ship new <name>...
84-
naval_fate.py ship <name> move <x> <y> [--speed=<kn>]
85-
naval_fate.py ship shoot <x> <y>
86-
naval_fate.py mine (set|remove) <x> <y> [--moored|--drifting]
87-
naval_fate.py -h | --help
88-
naval_fate.py --version
86+
naval_fate ship new <name>...
87+
naval_fate ship <name> move <x> <y> [--speed=<kn>]
88+
naval_fate ship shoot <x> <y>
89+
naval_fate mine (set|remove) <x> <y> [--moored|--drifting]
90+
naval_fate -h | --help
91+
naval_fate --version
8992
9093
Options:
9194
-h --help Show this screen.
@@ -101,6 +104,8 @@ Options:
101104

102105
## Testing
103106

104-
All tests from the python version have been implemented pass
107+
All tests from the python version have been implemented and all are passing.
108+
109+
New language agnostic tests have been added to `test_golang.docopt`.
105110

106-
To run them use `go test`
111+
To run them use `go test`.

0 commit comments

Comments
 (0)