Переглянути джерело

remove package github.com/docopt/docopt-go

fatedier 6 роки тому
батько
коміт
fe187eb8ec
38 змінених файлів з 158 додано та 4692 видалено
  1. 2 4
      glide.lock
  2. 0 2
      glide.yaml
  3. 0 25
      vendor/github.com/docopt/docopt-go/.gitignore
  4. 0 31
      vendor/github.com/docopt/docopt-go/.travis.yml
  5. 0 20
      vendor/github.com/docopt/docopt-go/LICENSE
  6. 0 88
      vendor/github.com/docopt/docopt-go/README.md
  7. 0 1239
      vendor/github.com/docopt/docopt-go/docopt.go
  8. 0 1536
      vendor/github.com/docopt/docopt-go/docopt_test.go
  9. 0 37
      vendor/github.com/docopt/docopt-go/example_test.go
  10. 0 29
      vendor/github.com/docopt/docopt-go/examples/arguments/arguments_example.go
  11. 0 26
      vendor/github.com/docopt/docopt-go/examples/calculator/calculator_example.go
  12. 0 76
      vendor/github.com/docopt/docopt-go/examples/config_file/config_file_example.go
  13. 0 22
      vendor/github.com/docopt/docopt-go/examples/counted/counted_example.go
  14. 0 38
      vendor/github.com/docopt/docopt-go/examples/git/branch/git_branch.go
  15. 0 30
      vendor/github.com/docopt/docopt-go/examples/git/checkout/git_checkout.go
  16. 0 37
      vendor/github.com/docopt/docopt-go/examples/git/clone/git_clone.go
  17. 0 108
      vendor/github.com/docopt/docopt-go/examples/git/git.go
  18. 0 34
      vendor/github.com/docopt/docopt-go/examples/git/push/git_push.go
  19. 0 28
      vendor/github.com/docopt/docopt-go/examples/git/remote/git_remote.go
  20. 0 28
      vendor/github.com/docopt/docopt-go/examples/naval_fate/naval_fate.go
  21. 0 19
      vendor/github.com/docopt/docopt-go/examples/odd_even/odd_even_example.go
  22. 0 43
      vendor/github.com/docopt/docopt-go/examples/options/options_example.go
  23. 0 24
      vendor/github.com/docopt/docopt-go/examples/options_shortcut/options_shortcut_example.go
  24. 0 16
      vendor/github.com/docopt/docopt-go/examples/quick/quick_example.go
  25. 0 31
      vendor/github.com/docopt/docopt-go/examples/type_assert/type_assert_example.go
  26. 0 9
      vendor/github.com/docopt/docopt-go/test_golang.docopt
  27. 0 957
      vendor/github.com/docopt/docopt-go/testcases.docopt
  28. 2 2
      vendor/github.com/fatedier/beego/controller.go
  29. 2 2
      vendor/github.com/fatedier/beego/controller_test.go
  30. 1 0
      vendor/github.com/fatedier/beego/logs/alils/signature.go
  31. 1 1
      vendor/github.com/fatedier/beego/orm/db.go
  32. 8 8
      vendor/github.com/fatedier/beego/template.go
  33. 1 1
      vendor/github.com/fatedier/beego/toolbox/statistics.go
  34. 132 132
      vendor/github.com/klauspost/cpuid/private/cpuid.go
  35. 2 2
      vendor/github.com/stretchr/testify/assert/assertions.go
  36. 2 2
      vendor/github.com/stretchr/testify/assert/assertions_test.go
  37. 1 1
      vendor/github.com/tjfoc/gmsm/sm4/sm4.go
  38. 4 4
      vendor/golang.org/x/crypto/ssh/kex.go

+ 2 - 4
glide.lock

@@ -1,5 +1,5 @@
-hash: 4095d78a15bf0e7ffdd63331ce75d7199d663cc8710dcd08b9dcd09ba3183eac
-updated: 2018-01-23T14:48:38.764359+08:00
+hash: 4826a83c4ef4490fd09c560e6a8c8737a7586a97f1beb72294123db65be5ac38
+updated: 2018-04-23T02:10:12.581595+08:00
 imports:
 - name: github.com/armon/go-socks5
   version: e75332964ef517daa070d7c38a9466a0d687e0a5
@@ -7,8 +7,6 @@ imports:
   version: 346938d642f2ec3594ed81d874461961cd0faa76
   subpackages:
   - spew
-- name: github.com/docopt/docopt-go
-  version: 784ddc588536785e7299f7272f39101f7faccc3f
 - name: github.com/fatedier/beego
   version: 6c6a4f5bd5eb5a39f7e289b8f345b55f75e7e3e8
   subpackages:

+ 0 - 2
glide.yaml

@@ -6,8 +6,6 @@ import:
   version: v1.1.0
   subpackages:
   - spew
-- package: github.com/docopt/docopt-go
-  version: 0.6.2
 - package: github.com/fatedier/beego
   version: 6c6a4f5bd5eb5a39f7e289b8f345b55f75e7e3e8
   subpackages:

+ 0 - 25
vendor/github.com/docopt/docopt-go/.gitignore

@@ -1,25 +0,0 @@
-# Compiled Object files, Static and Dynamic libs (Shared Objects)
-*.o
-*.a
-*.so
-
-# Folders
-_obj
-_test
-
-# Architecture specific extensions/prefixes
-*.[568vq]
-[568vq].out
-
-*.cgo1.go
-*.cgo2.c
-_cgo_defun.c
-_cgo_gotypes.go
-_cgo_export.*
-
-_testmain.go
-
-*.exe
-
-# coverage droppings
-profile.cov

+ 0 - 31
vendor/github.com/docopt/docopt-go/.travis.yml

@@ -1,31 +0,0 @@
-# Travis CI (http://travis-ci.org/) is a continuous integration
-# service for open source projects. This file configures it
-# to run unit tests for docopt-go.
-
-language: go
-
-go:
-    - 1.4
-    - 1.5
-    - tip
-
-matrix:
-    fast_finish: true
-
-before_install:
-    - go get golang.org/x/tools/cmd/vet
-    - go get golang.org/x/tools/cmd/cover
-    - go get github.com/golang/lint/golint
-    - go get github.com/mattn/goveralls
-
-install:
-    - go get -d -v ./... && go build -v ./...
-
-script:
-    - go vet -x ./...
-    - $HOME/gopath/bin/golint ./...
-    - go test -v ./...
-    - go test -covermode=count -coverprofile=profile.cov .
-
-after_script:
-    - $HOME/gopath/bin/goveralls -coverprofile=profile.cov -service=travis-ci

+ 0 - 20
vendor/github.com/docopt/docopt-go/LICENSE

@@ -1,20 +0,0 @@
-The MIT License (MIT)
-
-Copyright (c) 2013 Keith Batten
-
-Permission is hereby granted, free of charge, to any person obtaining a copy of
-this software and associated documentation files (the "Software"), to deal in
-the Software without restriction, including without limitation the rights to
-use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
-the Software, and to permit persons to whom the Software is furnished to do so,
-subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
-FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
-COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
-IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

+ 0 - 88
vendor/github.com/docopt/docopt-go/README.md

@@ -1,88 +0,0 @@
-docopt-go
-=========
-
-[![Build Status](https://travis-ci.org/docopt/docopt.go.svg?branch=master)](https://travis-ci.org/docopt/docopt.go)
-[![Coverage Status](https://coveralls.io/repos/docopt/docopt.go/badge.png)](https://coveralls.io/r/docopt/docopt.go)
-[![GoDoc](https://godoc.org/github.com/docopt/docopt.go?status.png)](https://godoc.org/github.com/docopt/docopt.go)
-
-An implementation of [docopt](http://docopt.org/) in the
-[Go](http://golang.org/) programming language.
-
-**docopt** helps you create *beautiful* command-line interfaces easily:
-
-```go
-package main
-
-import (
-	"fmt"
-	"github.com/docopt/docopt-go"
-)
-
-func main() {
-	  usage := `Naval Fate.
-
-Usage:
-  naval_fate ship new <name>...
-  naval_fate ship <name> move <x> <y> [--speed=<kn>]
-  naval_fate ship shoot <x> <y>
-  naval_fate mine (set|remove) <x> <y> [--moored|--drifting]
-  naval_fate -h | --help
-  naval_fate --version
-
-Options:
-  -h --help     Show this screen.
-  --version     Show version.
-  --speed=<kn>  Speed in knots [default: 10].
-  --moored      Moored (anchored) mine.
-  --drifting    Drifting mine.`
-
-	  arguments, _ := docopt.Parse(usage, nil, true, "Naval Fate 2.0", false)
-	  fmt.Println(arguments)
-}
-```
-
-**docopt** parses command-line arguments based on a help message. Don't
-write parser code: a good help message already has all the necessary
-information in it.
-
-## Installation
-
-⚠ Use the alias “docopt-go”. To use docopt in your Go code:
-
-```go
-import "github.com/docopt/docopt-go"
-```
-
-To install docopt according to your `$GOPATH`:
-
-```console
-$ go get github.com/docopt/docopt-go
-```
-
-## API
-
-```go
-func Parse(doc string, argv []string, help bool, version string,
-    optionsFirst bool, exit ...bool) (map[string]interface{}, error)
-```
-Parse `argv` based on the command-line interface described in `doc`.
-
-Given a conventional command-line help message, docopt creates a parser and
-processes the arguments. See
-https://github.com/docopt/docopt#help-message-format for a description of the
-help message format. If `argv` is `nil`, `os.Args[1:]` is used.
-
-docopt returns a map of option names to the values parsed from `argv`, and an
-error or `nil`.
-
-More documentation for docopt is available at
-[GoDoc.org](https://godoc.org/github.com/docopt/docopt.go).
-
-## Testing
-
-All tests from the Python version are implemented and passing
-at [Travis CI](https://travis-ci.org/docopt/docopt.go). New
-language-agnostic tests have been added
-to [test_golang.docopt](test_golang.docopt).
-
-To run tests for docopt-go, use `go test`.

+ 0 - 1239
vendor/github.com/docopt/docopt-go/docopt.go

@@ -1,1239 +0,0 @@
-// Licensed under terms of MIT license (see LICENSE-MIT)
-// Copyright (c) 2013 Keith Batten, kbatten@gmail.com
-
-/*
-Package docopt parses command-line arguments based on a help message.
-
-⚠ Use the alias “docopt-go”:
-	import "github.com/docopt/docopt-go"
-or
-	$ go get github.com/docopt/docopt-go
-*/
-package docopt
-
-import (
-	"fmt"
-	"os"
-	"reflect"
-	"regexp"
-	"strings"
-	"unicode"
-)
-
-/*
-Parse `argv` based on the command-line interface described in `doc`.
-
-Given a conventional command-line help message, docopt creates a parser and
-processes the arguments. See
-https://github.com/docopt/docopt#help-message-format for a description of the
-help message format. If `argv` is `nil`, `os.Args[1:]` is used.
-
-docopt returns a map of option names to the values parsed from `argv`, and an
-error or `nil`.
-
-Set `help` to `false` to disable automatic help messages on `-h` or `--help`.
-If `version` is a non-empty string, it will be printed when `--version` is
-specified. Set `optionsFirst` to `true` to require that options always come
-before positional arguments; otherwise they can overlap.
-
-By default, docopt calls `os.Exit(0)` if it handled a built-in option such as
-`-h` or `--version`. If the user errored with a wrong command or options,
-docopt exits with a return code of 1. To stop docopt from calling `os.Exit()`
-and to handle your own return codes, pass an optional last parameter of `false`
-for `exit`.
-*/
-func Parse(doc string, argv []string, help bool, version string,
-	optionsFirst bool, exit ...bool) (map[string]interface{}, error) {
-	// if "false" was the (optional) last arg, don't call os.Exit()
-	exitOk := true
-	if len(exit) > 0 {
-		exitOk = exit[0]
-	}
-	args, output, err := parse(doc, argv, help, version, optionsFirst)
-	if _, ok := err.(*UserError); ok {
-		// the user gave us bad input
-		fmt.Fprintln(os.Stderr, output)
-		if exitOk {
-			os.Exit(1)
-		}
-	} else if len(output) > 0 && err == nil {
-		// the user asked for help or `--version`
-		fmt.Println(output)
-		if exitOk {
-			os.Exit(0)
-		}
-	}
-	return args, err
-}
-
-// parse and return a map of args, output and all errors
-func parse(doc string, argv []string, help bool, version string, optionsFirst bool) (args map[string]interface{}, output string, err error) {
-	if argv == nil && len(os.Args) > 1 {
-		argv = os.Args[1:]
-	}
-
-	usageSections := parseSection("usage:", doc)
-
-	if len(usageSections) == 0 {
-		err = newLanguageError("\"usage:\" (case-insensitive) not found.")
-		return
-	}
-	if len(usageSections) > 1 {
-		err = newLanguageError("More than one \"usage:\" (case-insensitive).")
-		return
-	}
-	usage := usageSections[0]
-
-	options := parseDefaults(doc)
-	formal, err := formalUsage(usage)
-	if err != nil {
-		output = handleError(err, usage)
-		return
-	}
-
-	pat, err := parsePattern(formal, &options)
-	if err != nil {
-		output = handleError(err, usage)
-		return
-	}
-
-	patternArgv, err := parseArgv(newTokenList(argv, errorUser), &options, optionsFirst)
-	if err != nil {
-		output = handleError(err, usage)
-		return
-	}
-	patFlat, err := pat.flat(patternOption)
-	if err != nil {
-		output = handleError(err, usage)
-		return
-	}
-	patternOptions := patFlat.unique()
-
-	patFlat, err = pat.flat(patternOptionSSHORTCUT)
-	if err != nil {
-		output = handleError(err, usage)
-		return
-	}
-	for _, optionsShortcut := range patFlat {
-		docOptions := parseDefaults(doc)
-		optionsShortcut.children = docOptions.unique().diff(patternOptions)
-	}
-
-	if output = extras(help, version, patternArgv, doc); len(output) > 0 {
-		return
-	}
-
-	err = pat.fix()
-	if err != nil {
-		output = handleError(err, usage)
-		return
-	}
-	matched, left, collected := pat.match(&patternArgv, nil)
-	if matched && len(*left) == 0 {
-		patFlat, err = pat.flat(patternDefault)
-		if err != nil {
-			output = handleError(err, usage)
-			return
-		}
-		args = append(patFlat, *collected...).dictionary()
-		return
-	}
-
-	err = newUserError("")
-	output = handleError(err, usage)
-	return
-}
-
-func handleError(err error, usage string) string {
-	if _, ok := err.(*UserError); ok {
-		return strings.TrimSpace(fmt.Sprintf("%s\n%s", err, usage))
-	}
-	return ""
-}
-
-func parseSection(name, source string) []string {
-	p := regexp.MustCompile(`(?im)^([^\n]*` + name + `[^\n]*\n?(?:[ \t].*?(?:\n|$))*)`)
-	s := p.FindAllString(source, -1)
-	if s == nil {
-		s = []string{}
-	}
-	for i, v := range s {
-		s[i] = strings.TrimSpace(v)
-	}
-	return s
-}
-
-func parseDefaults(doc string) patternList {
-	defaults := patternList{}
-	p := regexp.MustCompile(`\n[ \t]*(-\S+?)`)
-	for _, s := range parseSection("options:", doc) {
-		// FIXME corner case "bla: options: --foo"
-		_, _, s = stringPartition(s, ":") // get rid of "options:"
-		split := p.Split("\n"+s, -1)[1:]
-		match := p.FindAllStringSubmatch("\n"+s, -1)
-		for i := range split {
-			optionDescription := match[i][1] + split[i]
-			if strings.HasPrefix(optionDescription, "-") {
-				defaults = append(defaults, parseOption(optionDescription))
-			}
-		}
-	}
-	return defaults
-}
-
-func parsePattern(source string, options *patternList) (*pattern, error) {
-	tokens := tokenListFromPattern(source)
-	result, err := parseExpr(tokens, options)
-	if err != nil {
-		return nil, err
-	}
-	if tokens.current() != nil {
-		return nil, tokens.errorFunc("unexpected ending: %s" + strings.Join(tokens.tokens, " "))
-	}
-	return newRequired(result...), nil
-}
-
-func parseArgv(tokens *tokenList, options *patternList, optionsFirst bool) (patternList, error) {
-	/*
-		Parse command-line argument vector.
-
-		If options_first:
-			argv ::= [ long | shorts ]* [ argument ]* [ '--' [ argument ]* ] ;
-		else:
-			argv ::= [ long | shorts | argument ]* [ '--' [ argument ]* ] ;
-	*/
-	parsed := patternList{}
-	for tokens.current() != nil {
-		if tokens.current().eq("--") {
-			for _, v := range tokens.tokens {
-				parsed = append(parsed, newArgument("", v))
-			}
-			return parsed, nil
-		} else if tokens.current().hasPrefix("--") {
-			pl, err := parseLong(tokens, options)
-			if err != nil {
-				return nil, err
-			}
-			parsed = append(parsed, pl...)
-		} else if tokens.current().hasPrefix("-") && !tokens.current().eq("-") {
-			ps, err := parseShorts(tokens, options)
-			if err != nil {
-				return nil, err
-			}
-			parsed = append(parsed, ps...)
-		} else if optionsFirst {
-			for _, v := range tokens.tokens {
-				parsed = append(parsed, newArgument("", v))
-			}
-			return parsed, nil
-		} else {
-			parsed = append(parsed, newArgument("", tokens.move().String()))
-		}
-	}
-	return parsed, nil
-}
-
-func parseOption(optionDescription string) *pattern {
-	optionDescription = strings.TrimSpace(optionDescription)
-	options, _, description := stringPartition(optionDescription, "  ")
-	options = strings.Replace(options, ",", " ", -1)
-	options = strings.Replace(options, "=", " ", -1)
-
-	short := ""
-	long := ""
-	argcount := 0
-	var value interface{}
-	value = false
-
-	reDefault := regexp.MustCompile(`(?i)\[default: (.*)\]`)
-	for _, s := range strings.Fields(options) {
-		if strings.HasPrefix(s, "--") {
-			long = s
-		} else if strings.HasPrefix(s, "-") {
-			short = s
-		} else {
-			argcount = 1
-		}
-		if argcount > 0 {
-			matched := reDefault.FindAllStringSubmatch(description, -1)
-			if len(matched) > 0 {
-				value = matched[0][1]
-			} else {
-				value = nil
-			}
-		}
-	}
-	return newOption(short, long, argcount, value)
-}
-
-func parseExpr(tokens *tokenList, options *patternList) (patternList, error) {
-	// expr ::= seq ( '|' seq )* ;
-	seq, err := parseSeq(tokens, options)
-	if err != nil {
-		return nil, err
-	}
-	if !tokens.current().eq("|") {
-		return seq, nil
-	}
-	var result patternList
-	if len(seq) > 1 {
-		result = patternList{newRequired(seq...)}
-	} else {
-		result = seq
-	}
-	for tokens.current().eq("|") {
-		tokens.move()
-		seq, err = parseSeq(tokens, options)
-		if err != nil {
-			return nil, err
-		}
-		if len(seq) > 1 {
-			result = append(result, newRequired(seq...))
-		} else {
-			result = append(result, seq...)
-		}
-	}
-	if len(result) > 1 {
-		return patternList{newEither(result...)}, nil
-	}
-	return result, nil
-}
-
-func parseSeq(tokens *tokenList, options *patternList) (patternList, error) {
-	// seq ::= ( atom [ '...' ] )* ;
-	result := patternList{}
-	for !tokens.current().match(true, "]", ")", "|") {
-		atom, err := parseAtom(tokens, options)
-		if err != nil {
-			return nil, err
-		}
-		if tokens.current().eq("...") {
-			atom = patternList{newOneOrMore(atom...)}
-			tokens.move()
-		}
-		result = append(result, atom...)
-	}
-	return result, nil
-}
-
-func parseAtom(tokens *tokenList, options *patternList) (patternList, error) {
-	// atom ::= '(' expr ')' | '[' expr ']' | 'options' | long | shorts | argument | command ;
-	tok := tokens.current()
-	result := patternList{}
-	if tokens.current().match(false, "(", "[") {
-		tokens.move()
-		var matching string
-		pl, err := parseExpr(tokens, options)
-		if err != nil {
-			return nil, err
-		}
-		if tok.eq("(") {
-			matching = ")"
-			result = patternList{newRequired(pl...)}
-		} else if tok.eq("[") {
-			matching = "]"
-			result = patternList{newOptional(pl...)}
-		}
-		moved := tokens.move()
-		if !moved.eq(matching) {
-			return nil, tokens.errorFunc("unmatched '%s', expected: '%s' got: '%s'", tok, matching, moved)
-		}
-		return result, nil
-	} else if tok.eq("options") {
-		tokens.move()
-		return patternList{newOptionsShortcut()}, nil
-	} else if tok.hasPrefix("--") && !tok.eq("--") {
-		return parseLong(tokens, options)
-	} else if tok.hasPrefix("-") && !tok.eq("-") && !tok.eq("--") {
-		return parseShorts(tokens, options)
-	} else if tok.hasPrefix("<") && tok.hasSuffix(">") || tok.isUpper() {
-		return patternList{newArgument(tokens.move().String(), nil)}, nil
-	}
-	return patternList{newCommand(tokens.move().String(), false)}, nil
-}
-
-func parseLong(tokens *tokenList, options *patternList) (patternList, error) {
-	// long ::= '--' chars [ ( ' ' | '=' ) chars ] ;
-	long, eq, v := stringPartition(tokens.move().String(), "=")
-	var value interface{}
-	var opt *pattern
-	if eq == "" && v == "" {
-		value = nil
-	} else {
-		value = v
-	}
-
-	if !strings.HasPrefix(long, "--") {
-		return nil, newError("long option '%s' doesn't start with --", long)
-	}
-	similar := patternList{}
-	for _, o := range *options {
-		if o.long == long {
-			similar = append(similar, o)
-		}
-	}
-	if tokens.err == errorUser && len(similar) == 0 { // if no exact match
-		similar = patternList{}
-		for _, o := range *options {
-			if strings.HasPrefix(o.long, long) {
-				similar = append(similar, o)
-			}
-		}
-	}
-	if len(similar) > 1 { // might be simply specified ambiguously 2+ times?
-		similarLong := make([]string, len(similar))
-		for i, s := range similar {
-			similarLong[i] = s.long
-		}
-		return nil, tokens.errorFunc("%s is not a unique prefix: %s?", long, strings.Join(similarLong, ", "))
-	} else if len(similar) < 1 {
-		argcount := 0
-		if eq == "=" {
-			argcount = 1
-		}
-		opt = newOption("", long, argcount, false)
-		*options = append(*options, opt)
-		if tokens.err == errorUser {
-			var val interface{}
-			if argcount > 0 {
-				val = value
-			} else {
-				val = true
-			}
-			opt = newOption("", long, argcount, val)
-		}
-	} else {
-		opt = newOption(similar[0].short, similar[0].long, similar[0].argcount, similar[0].value)
-		if opt.argcount == 0 {
-			if value != nil {
-				return nil, tokens.errorFunc("%s must not have an argument", opt.long)
-			}
-		} else {
-			if value == nil {
-				if tokens.current().match(true, "--") {
-					return nil, tokens.errorFunc("%s requires argument", opt.long)
-				}
-				moved := tokens.move()
-				if moved != nil {
-					value = moved.String() // only set as string if not nil
-				}
-			}
-		}
-		if tokens.err == errorUser {
-			if value != nil {
-				opt.value = value
-			} else {
-				opt.value = true
-			}
-		}
-	}
-
-	return patternList{opt}, nil
-}
-
-func parseShorts(tokens *tokenList, options *patternList) (patternList, error) {
-	// shorts ::= '-' ( chars )* [ [ ' ' ] chars ] ;
-	tok := tokens.move()
-	if !tok.hasPrefix("-") || tok.hasPrefix("--") {
-		return nil, newError("short option '%s' doesn't start with -", tok)
-	}
-	left := strings.TrimLeft(tok.String(), "-")
-	parsed := patternList{}
-	for left != "" {
-		var opt *pattern
-		short := "-" + left[0:1]
-		left = left[1:]
-		similar := patternList{}
-		for _, o := range *options {
-			if o.short == short {
-				similar = append(similar, o)
-			}
-		}
-		if len(similar) > 1 {
-			return nil, tokens.errorFunc("%s is specified ambiguously %d times", short, len(similar))
-		} else if len(similar) < 1 {
-			opt = newOption(short, "", 0, false)
-			*options = append(*options, opt)
-			if tokens.err == errorUser {
-				opt = newOption(short, "", 0, true)
-			}
-		} else { // why copying is necessary here?
-			opt = newOption(short, similar[0].long, similar[0].argcount, similar[0].value)
-			var value interface{}
-			if opt.argcount > 0 {
-				if left == "" {
-					if tokens.current().match(true, "--") {
-						return nil, tokens.errorFunc("%s requires argument", short)
-					}
-					value = tokens.move().String()
-				} else {
-					value = left
-					left = ""
-				}
-			}
-			if tokens.err == errorUser {
-				if value != nil {
-					opt.value = value
-				} else {
-					opt.value = true
-				}
-			}
-		}
-		parsed = append(parsed, opt)
-	}
-	return parsed, nil
-}
-
-func newTokenList(source []string, err errorType) *tokenList {
-	errorFunc := newError
-	if err == errorUser {
-		errorFunc = newUserError
-	} else if err == errorLanguage {
-		errorFunc = newLanguageError
-	}
-	return &tokenList{source, errorFunc, err}
-}
-
-func tokenListFromString(source string) *tokenList {
-	return newTokenList(strings.Fields(source), errorUser)
-}
-
-func tokenListFromPattern(source string) *tokenList {
-	p := regexp.MustCompile(`([\[\]\(\)\|]|\.\.\.)`)
-	source = p.ReplaceAllString(source, ` $1 `)
-	p = regexp.MustCompile(`\s+|(\S*<.*?>)`)
-	split := p.Split(source, -1)
-	match := p.FindAllStringSubmatch(source, -1)
-	var result []string
-	l := len(split)
-	for i := 0; i < l; i++ {
-		if len(split[i]) > 0 {
-			result = append(result, split[i])
-		}
-		if i < l-1 && len(match[i][1]) > 0 {
-			result = append(result, match[i][1])
-		}
-	}
-	return newTokenList(result, errorLanguage)
-}
-
-func formalUsage(section string) (string, error) {
-	_, _, section = stringPartition(section, ":") // drop "usage:"
-	pu := strings.Fields(section)
-
-	if len(pu) == 0 {
-		return "", newLanguageError("no fields found in usage (perhaps a spacing error).")
-	}
-
-	result := "( "
-	for _, s := range pu[1:] {
-		if s == pu[0] {
-			result += ") | ( "
-		} else {
-			result += s + " "
-		}
-	}
-	result += ")"
-
-	return result, nil
-}
-
-func extras(help bool, version string, options patternList, doc string) string {
-	if help {
-		for _, o := range options {
-			if (o.name == "-h" || o.name == "--help") && o.value == true {
-				return strings.Trim(doc, "\n")
-			}
-		}
-	}
-	if version != "" {
-		for _, o := range options {
-			if (o.name == "--version") && o.value == true {
-				return version
-			}
-		}
-	}
-	return ""
-}
-
-type errorType int
-
-const (
-	errorUser errorType = iota
-	errorLanguage
-)
-
-func (e errorType) String() string {
-	switch e {
-	case errorUser:
-		return "errorUser"
-	case errorLanguage:
-		return "errorLanguage"
-	}
-	return ""
-}
-
-// UserError records an error with program arguments.
-type UserError struct {
-	msg   string
-	Usage string
-}
-
-func (e UserError) Error() string {
-	return e.msg
-}
-func newUserError(msg string, f ...interface{}) error {
-	return &UserError{fmt.Sprintf(msg, f...), ""}
-}
-
-// LanguageError records an error with the doc string.
-type LanguageError struct {
-	msg string
-}
-
-func (e LanguageError) Error() string {
-	return e.msg
-}
-func newLanguageError(msg string, f ...interface{}) error {
-	return &LanguageError{fmt.Sprintf(msg, f...)}
-}
-
-var newError = fmt.Errorf
-
-type tokenList struct {
-	tokens    []string
-	errorFunc func(string, ...interface{}) error
-	err       errorType
-}
-type token string
-
-func (t *token) eq(s string) bool {
-	if t == nil {
-		return false
-	}
-	return string(*t) == s
-}
-func (t *token) match(matchNil bool, tokenStrings ...string) bool {
-	if t == nil && matchNil {
-		return true
-	} else if t == nil && !matchNil {
-		return false
-	}
-
-	for _, tok := range tokenStrings {
-		if tok == string(*t) {
-			return true
-		}
-	}
-	return false
-}
-func (t *token) hasPrefix(prefix string) bool {
-	if t == nil {
-		return false
-	}
-	return strings.HasPrefix(string(*t), prefix)
-}
-func (t *token) hasSuffix(suffix string) bool {
-	if t == nil {
-		return false
-	}
-	return strings.HasSuffix(string(*t), suffix)
-}
-func (t *token) isUpper() bool {
-	if t == nil {
-		return false
-	}
-	return isStringUppercase(string(*t))
-}
-func (t *token) String() string {
-	if t == nil {
-		return ""
-	}
-	return string(*t)
-}
-
-func (tl *tokenList) current() *token {
-	if len(tl.tokens) > 0 {
-		return (*token)(&(tl.tokens[0]))
-	}
-	return nil
-}
-
-func (tl *tokenList) length() int {
-	return len(tl.tokens)
-}
-
-func (tl *tokenList) move() *token {
-	if len(tl.tokens) > 0 {
-		t := tl.tokens[0]
-		tl.tokens = tl.tokens[1:]
-		return (*token)(&t)
-	}
-	return nil
-}
-
-type patternType uint
-
-const (
-	// leaf
-	patternArgument patternType = 1 << iota
-	patternCommand
-	patternOption
-
-	// branch
-	patternRequired
-	patternOptionAL
-	patternOptionSSHORTCUT // Marker/placeholder for [options] shortcut.
-	patternOneOrMore
-	patternEither
-
-	patternLeaf = patternArgument +
-		patternCommand +
-		patternOption
-	patternBranch = patternRequired +
-		patternOptionAL +
-		patternOptionSSHORTCUT +
-		patternOneOrMore +
-		patternEither
-	patternAll     = patternLeaf + patternBranch
-	patternDefault = 0
-)
-
-func (pt patternType) String() string {
-	switch pt {
-	case patternArgument:
-		return "argument"
-	case patternCommand:
-		return "command"
-	case patternOption:
-		return "option"
-	case patternRequired:
-		return "required"
-	case patternOptionAL:
-		return "optional"
-	case patternOptionSSHORTCUT:
-		return "optionsshortcut"
-	case patternOneOrMore:
-		return "oneormore"
-	case patternEither:
-		return "either"
-	case patternLeaf:
-		return "leaf"
-	case patternBranch:
-		return "branch"
-	case patternAll:
-		return "all"
-	case patternDefault:
-		return "default"
-	}
-	return ""
-}
-
-type pattern struct {
-	t patternType
-
-	children patternList
-
-	name  string
-	value interface{}
-
-	short    string
-	long     string
-	argcount int
-}
-
-type patternList []*pattern
-
-func newBranchPattern(t patternType, pl ...*pattern) *pattern {
-	var p pattern
-	p.t = t
-	p.children = make(patternList, len(pl))
-	copy(p.children, pl)
-	return &p
-}
-
-func newRequired(pl ...*pattern) *pattern {
-	return newBranchPattern(patternRequired, pl...)
-}
-
-func newEither(pl ...*pattern) *pattern {
-	return newBranchPattern(patternEither, pl...)
-}
-
-func newOneOrMore(pl ...*pattern) *pattern {
-	return newBranchPattern(patternOneOrMore, pl...)
-}
-
-func newOptional(pl ...*pattern) *pattern {
-	return newBranchPattern(patternOptionAL, pl...)
-}
-
-func newOptionsShortcut() *pattern {
-	var p pattern
-	p.t = patternOptionSSHORTCUT
-	return &p
-}
-
-func newLeafPattern(t patternType, name string, value interface{}) *pattern {
-	// default: value=nil
-	var p pattern
-	p.t = t
-	p.name = name
-	p.value = value
-	return &p
-}
-
-func newArgument(name string, value interface{}) *pattern {
-	// default: value=nil
-	return newLeafPattern(patternArgument, name, value)
-}
-
-func newCommand(name string, value interface{}) *pattern {
-	// default: value=false
-	var p pattern
-	p.t = patternCommand
-	p.name = name
-	p.value = value
-	return &p
-}
-
-func newOption(short, long string, argcount int, value interface{}) *pattern {
-	// default: "", "", 0, false
-	var p pattern
-	p.t = patternOption
-	p.short = short
-	p.long = long
-	if long != "" {
-		p.name = long
-	} else {
-		p.name = short
-	}
-	p.argcount = argcount
-	if value == false && argcount > 0 {
-		p.value = nil
-	} else {
-		p.value = value
-	}
-	return &p
-}
-
-func (p *pattern) flat(types patternType) (patternList, error) {
-	if p.t&patternLeaf != 0 {
-		if types == patternDefault {
-			types = patternAll
-		}
-		if p.t&types != 0 {
-			return patternList{p}, nil
-		}
-		return patternList{}, nil
-	}
-
-	if p.t&patternBranch != 0 {
-		if p.t&types != 0 {
-			return patternList{p}, nil
-		}
-		result := patternList{}
-		for _, child := range p.children {
-			childFlat, err := child.flat(types)
-			if err != nil {
-				return nil, err
-			}
-			result = append(result, childFlat...)
-		}
-		return result, nil
-	}
-	return nil, newError("unknown pattern type: %d, %d", p.t, types)
-}
-
-func (p *pattern) fix() error {
-	err := p.fixIdentities(nil)
-	if err != nil {
-		return err
-	}
-	p.fixRepeatingArguments()
-	return nil
-}
-
-func (p *pattern) fixIdentities(uniq patternList) error {
-	// Make pattern-tree tips point to same object if they are equal.
-	if p.t&patternBranch == 0 {
-		return nil
-	}
-	if uniq == nil {
-		pFlat, err := p.flat(patternDefault)
-		if err != nil {
-			return err
-		}
-		uniq = pFlat.unique()
-	}
-	for i, child := range p.children {
-		if child.t&patternBranch == 0 {
-			ind, err := uniq.index(child)
-			if err != nil {
-				return err
-			}
-			p.children[i] = uniq[ind]
-		} else {
-			err := child.fixIdentities(uniq)
-			if err != nil {
-				return err
-			}
-		}
-	}
-	return nil
-}
-
-func (p *pattern) fixRepeatingArguments() {
-	// Fix elements that should accumulate/increment values.
-	var either []patternList
-
-	for _, child := range p.transform().children {
-		either = append(either, child.children)
-	}
-	for _, cas := range either {
-		casMultiple := patternList{}
-		for _, e := range cas {
-			if cas.count(e) > 1 {
-				casMultiple = append(casMultiple, e)
-			}
-		}
-		for _, e := range casMultiple {
-			if e.t == patternArgument || e.t == patternOption && e.argcount > 0 {
-				switch e.value.(type) {
-				case string:
-					e.value = strings.Fields(e.value.(string))
-				case []string:
-				default:
-					e.value = []string{}
-				}
-			}
-			if e.t == patternCommand || e.t == patternOption && e.argcount == 0 {
-				e.value = 0
-			}
-		}
-	}
-}
-
-func (p *pattern) match(left *patternList, collected *patternList) (bool, *patternList, *patternList) {
-	if collected == nil {
-		collected = &patternList{}
-	}
-	if p.t&patternRequired != 0 {
-		l := left
-		c := collected
-		for _, p := range p.children {
-			var matched bool
-			matched, l, c = p.match(l, c)
-			if !matched {
-				return false, left, collected
-			}
-		}
-		return true, l, c
-	} else if p.t&patternOptionAL != 0 || p.t&patternOptionSSHORTCUT != 0 {
-		for _, p := range p.children {
-			_, left, collected = p.match(left, collected)
-		}
-		return true, left, collected
-	} else if p.t&patternOneOrMore != 0 {
-		if len(p.children) != 1 {
-			panic("OneOrMore.match(): assert len(p.children) == 1")
-		}
-		l := left
-		c := collected
-		var lAlt *patternList
-		matched := true
-		times := 0
-		for matched {
-			// could it be that something didn't match but changed l or c?
-			matched, l, c = p.children[0].match(l, c)
-			if matched {
-				times++
-			}
-			if lAlt == l {
-				break
-			}
-			lAlt = l
-		}
-		if times >= 1 {
-			return true, l, c
-		}
-		return false, left, collected
-	} else if p.t&patternEither != 0 {
-		type outcomeStruct struct {
-			matched   bool
-			left      *patternList
-			collected *patternList
-			length    int
-		}
-		outcomes := []outcomeStruct{}
-		for _, p := range p.children {
-			matched, l, c := p.match(left, collected)
-			outcome := outcomeStruct{matched, l, c, len(*l)}
-			if matched {
-				outcomes = append(outcomes, outcome)
-			}
-		}
-		if len(outcomes) > 0 {
-			minLen := outcomes[0].length
-			minIndex := 0
-			for i, v := range outcomes {
-				if v.length < minLen {
-					minIndex = i
-				}
-			}
-			return outcomes[minIndex].matched, outcomes[minIndex].left, outcomes[minIndex].collected
-		}
-		return false, left, collected
-	} else if p.t&patternLeaf != 0 {
-		pos, match := p.singleMatch(left)
-		var increment interface{}
-		if match == nil {
-			return false, left, collected
-		}
-		leftAlt := make(patternList, len((*left)[:pos]), len((*left)[:pos])+len((*left)[pos+1:]))
-		copy(leftAlt, (*left)[:pos])
-		leftAlt = append(leftAlt, (*left)[pos+1:]...)
-		sameName := patternList{}
-		for _, a := range *collected {
-			if a.name == p.name {
-				sameName = append(sameName, a)
-			}
-		}
-
-		switch p.value.(type) {
-		case int, []string:
-			switch p.value.(type) {
-			case int:
-				increment = 1
-			case []string:
-				switch match.value.(type) {
-				case string:
-					increment = []string{match.value.(string)}
-				default:
-					increment = match.value
-				}
-			}
-			if len(sameName) == 0 {
-				match.value = increment
-				collectedMatch := make(patternList, len(*collected), len(*collected)+1)
-				copy(collectedMatch, *collected)
-				collectedMatch = append(collectedMatch, match)
-				return true, &leftAlt, &collectedMatch
-			}
-			switch sameName[0].value.(type) {
-			case int:
-				sameName[0].value = sameName[0].value.(int) + increment.(int)
-			case []string:
-				sameName[0].value = append(sameName[0].value.([]string), increment.([]string)...)
-			}
-			return true, &leftAlt, collected
-		}
-		collectedMatch := make(patternList, len(*collected), len(*collected)+1)
-		copy(collectedMatch, *collected)
-		collectedMatch = append(collectedMatch, match)
-		return true, &leftAlt, &collectedMatch
-	}
-	panic("unmatched type")
-}
-
-func (p *pattern) singleMatch(left *patternList) (int, *pattern) {
-	if p.t&patternArgument != 0 {
-		for n, pat := range *left {
-			if pat.t&patternArgument != 0 {
-				return n, newArgument(p.name, pat.value)
-			}
-		}
-		return -1, nil
-	} else if p.t&patternCommand != 0 {
-		for n, pat := range *left {
-			if pat.t&patternArgument != 0 {
-				if pat.value == p.name {
-					return n, newCommand(p.name, true)
-				}
-				break
-			}
-		}
-		return -1, nil
-	} else if p.t&patternOption != 0 {
-		for n, pat := range *left {
-			if p.name == pat.name {
-				return n, pat
-			}
-		}
-		return -1, nil
-	}
-	panic("unmatched type")
-}
-
-func (p *pattern) String() string {
-	if p.t&patternOption != 0 {
-		return fmt.Sprintf("%s(%s, %s, %d, %+v)", p.t, p.short, p.long, p.argcount, p.value)
-	} else if p.t&patternLeaf != 0 {
-		return fmt.Sprintf("%s(%s, %+v)", p.t, p.name, p.value)
-	} else if p.t&patternBranch != 0 {
-		result := ""
-		for i, child := range p.children {
-			if i > 0 {
-				result += ", "
-			}
-			result += child.String()
-		}
-		return fmt.Sprintf("%s(%s)", p.t, result)
-	}
-	panic("unmatched type")
-}
-
-func (p *pattern) transform() *pattern {
-	/*
-		Expand pattern into an (almost) equivalent one, but with single Either.
-
-		Example: ((-a | -b) (-c | -d)) => (-a -c | -a -d | -b -c | -b -d)
-		Quirks: [-a] => (-a), (-a...) => (-a -a)
-	*/
-	result := []patternList{}
-	groups := []patternList{patternList{p}}
-	parents := patternRequired +
-		patternOptionAL +
-		patternOptionSSHORTCUT +
-		patternEither +
-		patternOneOrMore
-	for len(groups) > 0 {
-		children := groups[0]
-		groups = groups[1:]
-		var child *pattern
-		for _, c := range children {
-			if c.t&parents != 0 {
-				child = c
-				break
-			}
-		}
-		if child != nil {
-			children.remove(child)
-			if child.t&patternEither != 0 {
-				for _, c := range child.children {
-					r := patternList{}
-					r = append(r, c)
-					r = append(r, children...)
-					groups = append(groups, r)
-				}
-			} else if child.t&patternOneOrMore != 0 {
-				r := patternList{}
-				r = append(r, child.children.double()...)
-				r = append(r, children...)
-				groups = append(groups, r)
-			} else {
-				r := patternList{}
-				r = append(r, child.children...)
-				r = append(r, children...)
-				groups = append(groups, r)
-			}
-		} else {
-			result = append(result, children)
-		}
-	}
-	either := patternList{}
-	for _, e := range result {
-		either = append(either, newRequired(e...))
-	}
-	return newEither(either...)
-}
-
-func (p *pattern) eq(other *pattern) bool {
-	return reflect.DeepEqual(p, other)
-}
-
-func (pl patternList) unique() patternList {
-	table := make(map[string]bool)
-	result := patternList{}
-	for _, v := range pl {
-		if !table[v.String()] {
-			table[v.String()] = true
-			result = append(result, v)
-		}
-	}
-	return result
-}
-
-func (pl patternList) index(p *pattern) (int, error) {
-	for i, c := range pl {
-		if c.eq(p) {
-			return i, nil
-		}
-	}
-	return -1, newError("%s not in list", p)
-}
-
-func (pl patternList) count(p *pattern) int {
-	count := 0
-	for _, c := range pl {
-		if c.eq(p) {
-			count++
-		}
-	}
-	return count
-}
-
-func (pl patternList) diff(l patternList) patternList {
-	lAlt := make(patternList, len(l))
-	copy(lAlt, l)
-	result := make(patternList, 0, len(pl))
-	for _, v := range pl {
-		if v != nil {
-			match := false
-			for i, w := range lAlt {
-				if w.eq(v) {
-					match = true
-					lAlt[i] = nil
-					break
-				}
-			}
-			if match == false {
-				result = append(result, v)
-			}
-		}
-	}
-	return result
-}
-
-func (pl patternList) double() patternList {
-	l := len(pl)
-	result := make(patternList, l*2)
-	copy(result, pl)
-	copy(result[l:2*l], pl)
-	return result
-}
-
-func (pl *patternList) remove(p *pattern) {
-	(*pl) = pl.diff(patternList{p})
-}
-
-func (pl patternList) dictionary() map[string]interface{} {
-	dict := make(map[string]interface{})
-	for _, a := range pl {
-		dict[a.name] = a.value
-	}
-	return dict
-}
-
-func stringPartition(s, sep string) (string, string, string) {
-	sepPos := strings.Index(s, sep)
-	if sepPos == -1 { // no seperator found
-		return s, "", ""
-	}
-	split := strings.SplitN(s, sep, 2)
-	return split[0], sep, split[1]
-}
-
-// returns true if all cased characters in the string are uppercase
-// and there are there is at least one cased charcter
-func isStringUppercase(s string) bool {
-	if strings.ToUpper(s) != s {
-		return false
-	}
-	for _, c := range []rune(s) {
-		if unicode.IsUpper(c) {
-			return true
-		}
-	}
-	return false
-}

+ 0 - 1536
vendor/github.com/docopt/docopt-go/docopt_test.go

@@ -1,1536 +0,0 @@
-/*
-Based of off docopt.py: https://github.com/docopt/docopt
-
-Licensed under terms of MIT license (see LICENSE-MIT)
-Copyright (c) 2013 Keith Batten, kbatten@gmail.com
-*/
-
-package docopt
-
-import (
-	"bytes"
-	"encoding/json"
-	"fmt"
-	"io"
-	"io/ioutil"
-	"os"
-	"reflect"
-	"regexp"
-	"strings"
-	"testing"
-)
-
-func TestPatternFlat(t *testing.T) {
-	q := patternList{
-		newArgument("N", nil),
-		newOption("-a", "", 0, false),
-		newArgument("M", nil)}
-	p, err := newRequired(
-		newOneOrMore(newArgument("N", nil)),
-		newOption("-a", "", 0, false),
-		newArgument("M", nil)).flat(patternDefault)
-	if reflect.DeepEqual(p, q) != true {
-		t.Error(err)
-	}
-
-	q = patternList{newOptionsShortcut()}
-	p, err = newRequired(
-		newOptional(newOptionsShortcut()),
-		newOptional(newOption("-a", "", 0, false))).flat(patternOptionSSHORTCUT)
-	if reflect.DeepEqual(p, q) != true {
-		t.Error(err)
-	}
-	return
-}
-
-func TestOption(t *testing.T) {
-	if !parseOption("-h").eq(newOption("-h", "", 0, false)) {
-		t.Fail()
-	}
-	if !parseOption("--help").eq(newOption("", "--help", 0, false)) {
-		t.Fail()
-	}
-	if !parseOption("-h --help").eq(newOption("-h", "--help", 0, false)) {
-		t.Fail()
-	}
-	if !parseOption("-h, --help").eq(newOption("-h", "--help", 0, false)) {
-		t.Fail()
-	}
-
-	if !parseOption("-h TOPIC").eq(newOption("-h", "", 1, false)) {
-		t.Fail()
-	}
-	if !parseOption("--help TOPIC").eq(newOption("", "--help", 1, false)) {
-		t.Fail()
-	}
-	if !parseOption("-h TOPIC --help TOPIC").eq(newOption("-h", "--help", 1, false)) {
-		t.Fail()
-	}
-	if !parseOption("-h TOPIC, --help TOPIC").eq(newOption("-h", "--help", 1, false)) {
-		t.Fail()
-	}
-	if !parseOption("-h TOPIC, --help=TOPIC").eq(newOption("-h", "--help", 1, false)) {
-		t.Fail()
-	}
-
-	if !parseOption("-h  Description...").eq(newOption("-h", "", 0, false)) {
-		t.Fail()
-	}
-	if !parseOption("-h --help  Description...").eq(newOption("-h", "--help", 0, false)) {
-		t.Fail()
-	}
-	if !parseOption("-h TOPIC  Description...").eq(newOption("-h", "", 1, false)) {
-		t.Fail()
-	}
-
-	if !parseOption("    -h").eq(newOption("-h", "", 0, false)) {
-		t.Fail()
-	}
-
-	if !parseOption("-h TOPIC  Description... [default: 2]").eq(newOption("-h", "", 1, "2")) {
-		t.Fail()
-	}
-	if !parseOption("-h TOPIC  Descripton... [default: topic-1]").eq(newOption("-h", "", 1, "topic-1")) {
-		t.Fail()
-	}
-	if !parseOption("--help=TOPIC  ... [default: 3.14]").eq(newOption("", "--help", 1, "3.14")) {
-		t.Fail()
-	}
-	if !parseOption("-h, --help=DIR  ... [default: ./]").eq(newOption("-h", "--help", 1, "./")) {
-		t.Fail()
-	}
-	if !parseOption("-h TOPIC  Descripton... [dEfAuLt: 2]").eq(newOption("-h", "", 1, "2")) {
-		t.Fail()
-	}
-	return
-}
-
-func TestOptionName(t *testing.T) {
-	if newOption("-h", "", 0, false).name != "-h" {
-		t.Fail()
-	}
-	if newOption("-h", "--help", 0, false).name != "--help" {
-		t.Fail()
-	}
-	if newOption("", "--help", 0, false).name != "--help" {
-		t.Fail()
-	}
-	return
-}
-
-func TestCommands(t *testing.T) {
-	if v, err := Parse("Usage: prog add", []string{"add"}, true, "", false, false); reflect.DeepEqual(v, map[string]interface{}{"add": true}) != true {
-		t.Error(err)
-	}
-	if v, err := Parse("Usage: prog [add]", []string{}, true, "", false, false); reflect.DeepEqual(v, map[string]interface{}{"add": false}) != true {
-		t.Error(err)
-	}
-	if v, err := Parse("Usage: prog [add]", []string{"add"}, true, "", false, false); reflect.DeepEqual(v, map[string]interface{}{"add": true}) != true {
-		t.Error(err)
-	}
-	if v, err := Parse("Usage: prog (add|rm)", []string{"add"}, true, "", false, false); reflect.DeepEqual(v, map[string]interface{}{"add": true, "rm": false}) != true {
-		t.Error(err)
-	}
-	if v, err := Parse("Usage: prog (add|rm)", []string{"rm"}, true, "", false, false); reflect.DeepEqual(v, map[string]interface{}{"add": false, "rm": true}) != true {
-		t.Error(err)
-	}
-	if v, err := Parse("Usage: prog a b", []string{"a", "b"}, true, "", false, false); reflect.DeepEqual(v, map[string]interface{}{"a": true, "b": true}) != true {
-		t.Error(err)
-	}
-	_, err := Parse("Usage: prog a b", []string{"b", "a"}, true, "", false, false)
-	if _, ok := err.(*UserError); !ok {
-		t.Error(err)
-	}
-	return
-}
-
-func TestFormalUsage(t *testing.T) {
-	doc := `
-    Usage: prog [-hv] ARG
-           prog N M
-
-    prog is a program`
-	usage := parseSection("usage:", doc)[0]
-	if usage != "Usage: prog [-hv] ARG\n           prog N M" {
-		t.FailNow()
-	}
-	formal, err := formalUsage(usage)
-	if err != nil {
-		t.Fatal(err)
-	}
-	if formal != "( [-hv] ARG ) | ( N M )" {
-		t.Fail()
-	}
-	return
-}
-
-func TestParseArgv(t *testing.T) {
-	o := patternList{
-		newOption("-h", "", 0, false),
-		newOption("-v", "--verbose", 0, false),
-		newOption("-f", "--file", 1, false),
-	}
-
-	p, err := parseArgv(tokenListFromString(""), &o, false)
-	q := patternList{}
-	if reflect.DeepEqual(p, q) != true {
-		t.Error(err)
-	}
-
-	p, err = parseArgv(tokenListFromString("-h"), &o, false)
-	q = patternList{newOption("-h", "", 0, true)}
-	if reflect.DeepEqual(p, q) != true {
-		t.Error(err)
-	}
-
-	p, err = parseArgv(tokenListFromString("-h --verbose"), &o, false)
-	q = patternList{
-		newOption("-h", "", 0, true),
-		newOption("-v", "--verbose", 0, true),
-	}
-	if reflect.DeepEqual(p, q) != true {
-		t.Error(err)
-	}
-
-	p, err = parseArgv(tokenListFromString("-h --file f.txt"), &o, false)
-	q = patternList{
-		newOption("-h", "", 0, true),
-		newOption("-f", "--file", 1, "f.txt"),
-	}
-	if reflect.DeepEqual(p, q) != true {
-		t.Error(err)
-	}
-
-	p, err = parseArgv(tokenListFromString("-h --file f.txt arg"), &o, false)
-	q = patternList{
-		newOption("-h", "", 0, true),
-		newOption("-f", "--file", 1, "f.txt"),
-		newArgument("", "arg"),
-	}
-	if reflect.DeepEqual(p, q) != true {
-		t.Error(err)
-	}
-
-	p, err = parseArgv(tokenListFromString("-h --file f.txt arg arg2"), &o, false)
-	q = patternList{
-		newOption("-h", "", 0, true),
-		newOption("-f", "--file", 1, "f.txt"),
-		newArgument("", "arg"),
-		newArgument("", "arg2"),
-	}
-	if reflect.DeepEqual(p, q) != true {
-		t.Error(err)
-	}
-
-	p, err = parseArgv(tokenListFromString("-h arg -- -v"), &o, false)
-	q = patternList{
-		newOption("-h", "", 0, true),
-		newArgument("", "arg"),
-		newArgument("", "--"),
-		newArgument("", "-v"),
-	}
-	if reflect.DeepEqual(p, q) != true {
-		t.Error(err)
-	}
-}
-
-func TestParsePattern(t *testing.T) {
-	o := patternList{
-		newOption("-h", "", 0, false),
-		newOption("-v", "--verbose", 0, false),
-		newOption("-f", "--file", 1, false),
-	}
-
-	p, err := parsePattern("[ -h ]", &o)
-	q := newRequired(newOptional(newOption("-h", "", 0, false)))
-	if p.eq(q) != true {
-		t.Error(err)
-	}
-
-	p, err = parsePattern("[ ARG ... ]", &o)
-	q = newRequired(newOptional(
-		newOneOrMore(
-			newArgument("ARG", nil))))
-	if p.eq(q) != true {
-		t.Error(err)
-	}
-
-	p, err = parsePattern("[ -h | -v ]", &o)
-	q = newRequired(
-		newOptional(
-			newEither(
-				newOption("-h", "", 0, false),
-				newOption("-v", "--verbose", 0, false))))
-	if p.eq(q) != true {
-		t.Error(err)
-	}
-
-	p, err = parsePattern("( -h | -v [ --file <f> ] )", &o)
-	q = newRequired(
-		newRequired(
-			newEither(
-				newOption("-h", "", 0, false),
-				newRequired(
-					newOption("-v", "--verbose", 0, false),
-					newOptional(
-						newOption("-f", "--file", 1, nil))))))
-	if p.eq(q) != true {
-		t.Error(err)
-	}
-
-	p, err = parsePattern("(-h|-v[--file=<f>]N...)", &o)
-	q = newRequired(
-		newRequired(
-			newEither(
-				newOption("-h", "", 0, false),
-				newRequired(
-					newOption("-v", "--verbose", 0, false),
-					newOptional(
-						newOption("-f", "--file", 1, nil)),
-					newOneOrMore(
-						newArgument("N", nil))))))
-	if p.eq(q) != true {
-		t.Error(err)
-	}
-
-	p, err = parsePattern("(N [M | (K | L)] | O P)", &o)
-	q = newRequired(
-		newRequired(
-			newEither(
-				newRequired(
-					newArgument("N", nil),
-					newOptional(
-						newEither(
-							newArgument("M", nil),
-							newRequired(
-								newEither(
-									newArgument("K", nil),
-									newArgument("L", nil)))))),
-				newRequired(
-					newArgument("O", nil),
-					newArgument("P", nil)))))
-	if p.eq(q) != true {
-		t.Error(err)
-	}
-
-	p, err = parsePattern("[ -h ] [N]", &o)
-	q = newRequired(
-		newOptional(
-			newOption("-h", "", 0, false)),
-		newOptional(
-			newArgument("N", nil)))
-	if p.eq(q) != true {
-		t.Error(err)
-	}
-
-	p, err = parsePattern("[options]", &o)
-	q = newRequired(
-		newOptional(
-			newOptionsShortcut()))
-	if p.eq(q) != true {
-		t.Error(err)
-	}
-
-	p, err = parsePattern("[options] A", &o)
-	q = newRequired(
-		newOptional(
-			newOptionsShortcut()),
-		newArgument("A", nil))
-	if p.eq(q) != true {
-		t.Error(err)
-	}
-
-	p, err = parsePattern("-v [options]", &o)
-	q = newRequired(
-		newOption("-v", "--verbose", 0, false),
-		newOptional(
-			newOptionsShortcut()))
-	if p.eq(q) != true {
-		t.Error(err)
-	}
-
-	p, err = parsePattern("ADD", &o)
-	q = newRequired(newArgument("ADD", nil))
-	if p.eq(q) != true {
-		t.Error(err)
-	}
-
-	p, err = parsePattern("<add>", &o)
-	q = newRequired(newArgument("<add>", nil))
-	if p.eq(q) != true {
-		t.Error(err)
-	}
-
-	p, err = parsePattern("add", &o)
-	q = newRequired(newCommand("add", false))
-	if p.eq(q) != true {
-		t.Error(err)
-	}
-}
-
-func TestOptionMatch(t *testing.T) {
-	v, w, x := newOption("-a", "", 0, false).match(
-		&patternList{newOption("-a", "", 0, true)}, nil)
-	y := patternList{newOption("-a", "", 0, true)}
-	if v != true ||
-		reflect.DeepEqual(*w, patternList{}) != true ||
-		reflect.DeepEqual(*x, y) != true {
-		t.Fail()
-	}
-
-	v, w, x = newOption("-a", "", 0, false).match(
-		&patternList{newOption("-x", "", 0, false)}, nil)
-	y = patternList{newOption("-x", "", 0, false)}
-	if v != false ||
-		reflect.DeepEqual(*w, y) != true ||
-		reflect.DeepEqual(*x, patternList{}) != true {
-		t.Fail()
-	}
-
-	v, w, x = newOption("-a", "", 0, false).match(
-		&patternList{newOption("-x", "", 0, false)}, nil)
-	y = patternList{newOption("-x", "", 0, false)}
-	if v != false ||
-		reflect.DeepEqual(*w, y) != true ||
-		reflect.DeepEqual(*x, patternList{}) != true {
-		t.Fail()
-	}
-	v, w, x = newOption("-a", "", 0, false).match(
-		&patternList{newArgument("N", nil)}, nil)
-	y = patternList{newArgument("N", nil)}
-	if v != false ||
-		reflect.DeepEqual(*w, y) != true ||
-		reflect.DeepEqual(*x, patternList{}) != true {
-		t.Fail()
-	}
-
-	v, w, x = newOption("-a", "", 0, false).match(
-		&patternList{
-			newOption("-x", "", 0, false),
-			newOption("-a", "", 0, false),
-			newArgument("N", nil)}, nil)
-	y = patternList{
-		newOption("-x", "", 0, false),
-		newArgument("N", nil)}
-	z := patternList{newOption("-a", "", 0, false)}
-	if v != true ||
-		reflect.DeepEqual(*w, y) != true ||
-		reflect.DeepEqual(*x, z) != true {
-		t.Fail()
-	}
-
-	v, w, x = newOption("-a", "", 0, false).match(
-		&patternList{
-			newOption("-a", "", 0, true),
-			newOption("-a", "", 0, false)}, nil)
-	y = patternList{newOption("-a", "", 0, false)}
-	z = patternList{newOption("-a", "", 0, true)}
-	if v != true ||
-		reflect.DeepEqual(*w, y) != true ||
-		reflect.DeepEqual(*x, z) != true {
-		t.Fail()
-	}
-}
-
-func TestArgumentMatch(t *testing.T) {
-	v, w, x := newArgument("N", nil).match(
-		&patternList{newArgument("N", 9)}, nil)
-	y := patternList{newArgument("N", 9)}
-	if v != true ||
-		reflect.DeepEqual(*w, patternList{}) != true ||
-		reflect.DeepEqual(*x, y) != true {
-		t.Fail()
-	}
-
-	v, w, x = newArgument("N", nil).match(
-		&patternList{newOption("-x", "", 0, false)}, nil)
-	y = patternList{newOption("-x", "", 0, false)}
-	if v != false ||
-		reflect.DeepEqual(*w, y) != true ||
-		reflect.DeepEqual(*x, patternList{}) != true {
-		t.Fail()
-	}
-
-	v, w, x = newArgument("N", nil).match(
-		&patternList{newOption("-x", "", 0, false),
-			newOption("-a", "", 0, false),
-			newArgument("", 5)}, nil)
-	y = patternList{newOption("-x", "", 0, false),
-		newOption("-a", "", 0, false)}
-	z := patternList{newArgument("N", 5)}
-	if v != true ||
-		reflect.DeepEqual(*w, y) != true ||
-		reflect.DeepEqual(*x, z) != true {
-		t.Fail()
-	}
-
-	v, w, x = newArgument("N", nil).match(
-		&patternList{newArgument("", 9),
-			newArgument("", 0)}, nil)
-	y = patternList{newArgument("", 0)}
-	z = patternList{newArgument("N", 9)}
-	if v != true ||
-		reflect.DeepEqual(*w, y) != true ||
-		reflect.DeepEqual(*x, z) != true {
-		t.Fail()
-	}
-}
-
-func TestCommandMatch(t *testing.T) {
-	v, w, x := newCommand("c", false).match(
-		&patternList{newArgument("", "c")}, nil)
-	y := patternList{newCommand("c", true)}
-	if v != true ||
-		reflect.DeepEqual(*w, patternList{}) != true ||
-		reflect.DeepEqual(*x, y) != true {
-		t.Fail()
-	}
-
-	v, w, x = newCommand("c", false).match(
-		&patternList{newOption("-x", "", 0, false)}, nil)
-	y = patternList{newOption("-x", "", 0, false)}
-	if v != false ||
-		reflect.DeepEqual(*w, y) != true ||
-		reflect.DeepEqual(*x, patternList{}) != true {
-		t.Fail()
-	}
-
-	v, w, x = newCommand("c", false).match(
-		&patternList{
-			newOption("-x", "", 0, false),
-			newOption("-a", "", 0, false),
-			newArgument("", "c")}, nil)
-	y = patternList{newOption("-x", "", 0, false),
-		newOption("-a", "", 0, false)}
-	z := patternList{newCommand("c", true)}
-	if v != true ||
-		reflect.DeepEqual(*w, y) != true ||
-		reflect.DeepEqual(*x, z) != true {
-		t.Fail()
-	}
-
-	v, w, x = newEither(
-		newCommand("add", false),
-		newCommand("rm", false)).match(
-		&patternList{newArgument("", "rm")}, nil)
-	y = patternList{newCommand("rm", true)}
-	if v != true ||
-		reflect.DeepEqual(*w, patternList{}) != true ||
-		reflect.DeepEqual(*x, y) != true {
-		t.Fail()
-	}
-}
-
-func TestOptionalMatch(t *testing.T) {
-	v, w, x := newOptional(newOption("-a", "", 0, false)).match(
-		&patternList{newOption("-a", "", 0, false)}, nil)
-	y := patternList{newOption("-a", "", 0, false)}
-	if v != true ||
-		reflect.DeepEqual(*w, patternList{}) != true ||
-		reflect.DeepEqual(*x, y) != true {
-		t.Fail()
-	}
-
-	v, w, x = newOptional(newOption("-a", "", 0, false)).match(
-		&patternList{}, nil)
-	if v != true ||
-		reflect.DeepEqual(*w, patternList{}) != true ||
-		reflect.DeepEqual(*x, patternList{}) != true {
-		t.Fail()
-	}
-
-	v, w, x = newOptional(newOption("-a", "", 0, false)).match(
-		&patternList{newOption("-x", "", 0, false)}, nil)
-	y = patternList{newOption("-x", "", 0, false)}
-	if v != true ||
-		reflect.DeepEqual(*w, y) != true ||
-		reflect.DeepEqual(*x, patternList{}) != true {
-		t.Fail()
-	}
-
-	v, w, x = newOptional(newOption("-a", "", 0, false),
-		newOption("-b", "", 0, false)).match(
-		&patternList{newOption("-a", "", 0, false)}, nil)
-	y = patternList{newOption("-a", "", 0, false)}
-	if v != true ||
-		reflect.DeepEqual(*w, patternList{}) != true ||
-		reflect.DeepEqual(*x, y) != true {
-		t.Fail()
-	}
-
-	v, w, x = newOptional(newOption("-a", "", 0, false),
-		newOption("-b", "", 0, false)).match(
-		&patternList{newOption("-b", "", 0, false)}, nil)
-	y = patternList{newOption("-b", "", 0, false)}
-	if v != true ||
-		reflect.DeepEqual(*w, patternList{}) != true ||
-		reflect.DeepEqual(*x, y) != true {
-		t.Fail()
-	}
-
-	v, w, x = newOptional(newOption("-a", "", 0, false),
-		newOption("-b", "", 0, false)).match(
-		&patternList{newOption("-x", "", 0, false)}, nil)
-	y = patternList{newOption("-x", "", 0, false)}
-	if v != true ||
-		reflect.DeepEqual(*w, y) != true ||
-		reflect.DeepEqual(*x, patternList{}) != true {
-		t.Fail()
-	}
-
-	v, w, x = newOptional(newArgument("N", nil)).match(
-		&patternList{newArgument("", 9)}, nil)
-	y = patternList{newArgument("N", 9)}
-	if v != true ||
-		reflect.DeepEqual(*w, patternList{}) != true ||
-		reflect.DeepEqual(*x, y) != true {
-		t.Fail()
-	}
-
-	v, w, x = newOptional(newOption("-a", "", 0, false),
-		newOption("-b", "", 0, false)).match(
-		&patternList{newOption("-b", "", 0, false),
-			newOption("-x", "", 0, false),
-			newOption("-a", "", 0, false)}, nil)
-	y = patternList{newOption("-x", "", 0, false)}
-	z := patternList{newOption("-a", "", 0, false),
-		newOption("-b", "", 0, false)}
-	if v != true ||
-		reflect.DeepEqual(*w, y) != true ||
-		reflect.DeepEqual(*x, z) != true {
-		t.Fail()
-	}
-}
-
-func TestRequiredMatch(t *testing.T) {
-	v, w, x := newRequired(newOption("-a", "", 0, false)).match(
-		&patternList{newOption("-a", "", 0, false)}, nil)
-	y := patternList{newOption("-a", "", 0, false)}
-	if v != true ||
-		reflect.DeepEqual(*w, patternList{}) != true ||
-		reflect.DeepEqual(*x, y) != true {
-		t.Fail()
-	}
-
-	v, w, x = newRequired(newOption("-a", "", 0, false)).match(&patternList{}, nil)
-	if v != false ||
-		reflect.DeepEqual(*w, patternList{}) != true ||
-		reflect.DeepEqual(*x, patternList{}) != true {
-		t.Fail()
-	}
-
-	v, w, x = newRequired(newOption("-a", "", 0, false)).match(
-		&patternList{newOption("-x", "", 0, false)}, nil)
-	y = patternList{newOption("-x", "", 0, false)}
-	if v != false ||
-		reflect.DeepEqual(*w, y) != true ||
-		reflect.DeepEqual(*x, patternList{}) != true {
-		t.Fail()
-	}
-	v, w, x = newRequired(newOption("-a", "", 0, false),
-		newOption("-b", "", 0, false)).match(
-		&patternList{newOption("-a", "", 0, false)}, nil)
-	y = patternList{newOption("-a", "", 0, false)}
-	if v != false ||
-		reflect.DeepEqual(*w, y) != true ||
-		reflect.DeepEqual(*x, patternList{}) != true {
-		t.Fail()
-	}
-}
-
-func TestEitherMatch(t *testing.T) {
-	v, w, x := newEither(
-		newOption("-a", "", 0, false),
-		newOption("-b", "", 0, false)).match(
-		&patternList{newOption("-a", "", 0, false)}, nil)
-	y := patternList{newOption("-a", "", 0, false)}
-	if v != true ||
-		reflect.DeepEqual(*w, patternList{}) != true ||
-		reflect.DeepEqual(*x, y) != true {
-		t.Fail()
-	}
-
-	v, w, x = newEither(
-		newOption("-a", "", 0, false),
-		newOption("-b", "", 0, false)).match(&patternList{
-		newOption("-a", "", 0, false),
-		newOption("-b", "", 0, false)}, nil)
-	y = patternList{newOption("-b", "", 0, false)}
-	z := patternList{newOption("-a", "", 0, false)}
-	if v != true ||
-		reflect.DeepEqual(*w, y) != true ||
-		reflect.DeepEqual(*x, z) != true {
-		t.Fail()
-	}
-
-	v, w, x = newEither(
-		newOption("-a", "", 0, false),
-		newOption("-b", "", 0, false)).match(&patternList{
-		newOption("-x", "", 0, false)}, nil)
-	y = patternList{newOption("-x", "", 0, false)}
-	z = patternList{}
-	if v != false ||
-		reflect.DeepEqual(*w, y) != true ||
-		reflect.DeepEqual(*x, z) != true {
-		t.Fail()
-	}
-
-	v, w, x = newEither(
-		newOption("-a", "", 0, false),
-		newOption("-b", "", 0, false),
-		newOption("-c", "", 0, false)).match(&patternList{
-		newOption("-x", "", 0, false),
-		newOption("-b", "", 0, false)}, nil)
-	y = patternList{newOption("-x", "", 0, false)}
-	z = patternList{newOption("-b", "", 0, false)}
-	if v != true ||
-		reflect.DeepEqual(*w, y) != true ||
-		reflect.DeepEqual(*x, z) != true {
-		t.Fail()
-	}
-	v, w, x = newEither(
-		newArgument("M", nil),
-		newRequired(newArgument("N", nil),
-			newArgument("M", nil))).match(&patternList{
-		newArgument("", 1),
-		newArgument("", 2)}, nil)
-	y = patternList{}
-	z = patternList{newArgument("N", 1), newArgument("M", 2)}
-	if v != true ||
-		reflect.DeepEqual(*w, y) != true ||
-		reflect.DeepEqual(*x, z) != true {
-		t.Fail()
-	}
-}
-
-func TestOneOrMoreMatch(t *testing.T) {
-	v, w, x := newOneOrMore(newArgument("N", nil)).match(
-		&patternList{newArgument("", 9)}, nil)
-	y := patternList{newArgument("N", 9)}
-	if v != true ||
-		reflect.DeepEqual(*w, patternList{}) != true ||
-		reflect.DeepEqual(*x, y) != true {
-		t.Fail()
-	}
-
-	v, w, x = newOneOrMore(newArgument("N", nil)).match(
-		&patternList{}, nil)
-	y = patternList{}
-	z := patternList{}
-	if v != false ||
-		reflect.DeepEqual(*w, y) != true ||
-		reflect.DeepEqual(*x, z) != true {
-		t.Fail()
-	}
-
-	v, w, x = newOneOrMore(newArgument("N", nil)).match(
-		&patternList{newOption("-x", "", 0, false)}, nil)
-	y = patternList{newOption("-x", "", 0, false)}
-	z = patternList{}
-	if v != false ||
-		reflect.DeepEqual(*w, y) != true ||
-		reflect.DeepEqual(*x, z) != true {
-		t.Fail()
-	}
-
-	v, w, x = newOneOrMore(newArgument("N", nil)).match(
-		&patternList{newArgument("", 9), newArgument("", 8)}, nil)
-	y = patternList{}
-	z = patternList{newArgument("N", 9), newArgument("N", 8)}
-	if v != true ||
-		reflect.DeepEqual(*w, y) != true ||
-		reflect.DeepEqual(*x, z) != true {
-		t.Fail()
-	}
-
-	v, w, x = newOneOrMore(newArgument("N", nil)).match(&patternList{
-		newArgument("", 9),
-		newOption("-x", "", 0, false),
-		newArgument("", 8)}, nil)
-	y = patternList{newOption("-x", "", 0, false)}
-	z = patternList{newArgument("N", 9), newArgument("N", 8)}
-	if v != true ||
-		reflect.DeepEqual(*w, y) != true ||
-		reflect.DeepEqual(*x, z) != true {
-		t.Fail()
-	}
-
-	v, w, x = newOneOrMore(newOption("-a", "", 0, false)).match(&patternList{
-		newOption("-a", "", 0, false),
-		newArgument("", 8),
-		newOption("-a", "", 0, false)}, nil)
-	y = patternList{newArgument("", 8)}
-	z = patternList{newOption("-a", "", 0, false), newOption("-a", "", 0, false)}
-	if v != true ||
-		reflect.DeepEqual(*w, y) != true ||
-		reflect.DeepEqual(*x, z) != true {
-		t.Fail()
-	}
-
-	v, w, x = newOneOrMore(newOption("-a", "", 0, false)).match(&patternList{
-		newArgument("", 8),
-		newOption("-x", "", 0, false)}, nil)
-	y = patternList{newArgument("", 8), newOption("-x", "", 0, false)}
-	z = patternList{}
-	if v != false ||
-		reflect.DeepEqual(*w, y) != true ||
-		reflect.DeepEqual(*x, z) != true {
-		t.Fail()
-	}
-
-	v, w, x = newOneOrMore(newRequired(newOption("-a", "", 0, false),
-		newArgument("N", nil))).match(&patternList{
-		newOption("-a", "", 0, false),
-		newArgument("", 1),
-		newOption("-x", "", 0, false),
-		newOption("-a", "", 0, false),
-		newArgument("", 2)}, nil)
-	y = patternList{newOption("-x", "", 0, false)}
-	z = patternList{newOption("-a", "", 0, false),
-		newArgument("N", 1),
-		newOption("-a", "", 0, false),
-		newArgument("N", 2)}
-	if v != true ||
-		reflect.DeepEqual(*w, y) != true ||
-		reflect.DeepEqual(*x, z) != true {
-		t.Fail()
-	}
-
-	v, w, x = newOneOrMore(newOptional(newArgument("N", nil))).match(
-		&patternList{newArgument("", 9)}, nil)
-	y = patternList{}
-	z = patternList{newArgument("N", 9)}
-	if v != true ||
-		reflect.DeepEqual(*w, y) != true ||
-		reflect.DeepEqual(*x, z) != true {
-		t.Fail()
-	}
-}
-
-func TestListArgumentMatch(t *testing.T) {
-	p := newRequired(
-		newArgument("N", nil),
-		newArgument("N", nil))
-	p.fix()
-	v, w, x := p.match(&patternList{newArgument("", "1"),
-		newArgument("", "2")}, nil)
-	y := patternList{newArgument("N", []string{"1", "2"})}
-	if v != true ||
-		reflect.DeepEqual(*w, patternList{}) != true ||
-		reflect.DeepEqual(*x, y) != true {
-		t.Fail()
-	}
-
-	p = newOneOrMore(newArgument("N", nil))
-	p.fix()
-	v, w, x = p.match(&patternList{newArgument("", "1"),
-		newArgument("", "2"), newArgument("", "3")}, nil)
-	y = patternList{newArgument("N", []string{"1", "2", "3"})}
-	if v != true ||
-		reflect.DeepEqual(*w, patternList{}) != true ||
-		reflect.DeepEqual(*x, y) != true {
-		t.Fail()
-	}
-
-	p = newRequired(newArgument("N", nil),
-		newOneOrMore(newArgument("N", nil)))
-	p.fix()
-	v, w, x = p.match(&patternList{
-		newArgument("", "1"),
-		newArgument("", "2"),
-		newArgument("", "3")}, nil)
-	y = patternList{newArgument("N", []string{"1", "2", "3"})}
-	if v != true ||
-		reflect.DeepEqual(*w, patternList{}) != true ||
-		reflect.DeepEqual(*x, y) != true {
-		t.Fail()
-	}
-
-	p = newRequired(newArgument("N", nil),
-		newRequired(newArgument("N", nil)))
-	p.fix()
-	v, w, x = p.match(&patternList{
-		newArgument("", "1"),
-		newArgument("", "2")}, nil)
-	y = patternList{newArgument("N", []string{"1", "2"})}
-	if v != true ||
-		reflect.DeepEqual(*w, patternList{}) != true ||
-		reflect.DeepEqual(*x, y) != true {
-		t.Fail()
-	}
-}
-
-func TestBasicPatternMatching(t *testing.T) {
-	// ( -a N [ -x Z ] )
-	p := newRequired(
-		newOption("-a", "", 0, false),
-		newArgument("N", nil),
-		newOptional(
-			newOption("-x", "", 0, false),
-			newArgument("Z", nil)))
-
-	// -a N
-	q := patternList{newOption("-a", "", 0, false), newArgument("", 9)}
-	y := patternList{newOption("-a", "", 0, false), newArgument("N", 9)}
-	v, w, x := p.match(&q, nil)
-	if v != true ||
-		reflect.DeepEqual(*w, patternList{}) != true ||
-		reflect.DeepEqual(*x, y) != true {
-		t.Fail()
-	}
-
-	// -a -x N Z
-	q = patternList{newOption("-a", "", 0, false),
-		newOption("-x", "", 0, false),
-		newArgument("", 9), newArgument("", 5)}
-	y = patternList{}
-	z := patternList{newOption("-a", "", 0, false), newArgument("N", 9),
-		newOption("-x", "", 0, false), newArgument("Z", 5)}
-	v, w, x = p.match(&q, nil)
-	if v != true ||
-		reflect.DeepEqual(*w, y) != true ||
-		reflect.DeepEqual(*x, z) != true {
-		t.Fail()
-	}
-
-	// -x N Z  # BZZ!
-	q = patternList{newOption("-x", "", 0, false),
-		newArgument("", 9), newArgument("", 5)}
-	y = patternList{newOption("-x", "", 0, false),
-		newArgument("", 9), newArgument("", 5)}
-	z = patternList{}
-	v, w, x = p.match(&q, nil)
-	if v != false ||
-		reflect.DeepEqual(*w, y) != true ||
-		reflect.DeepEqual(*x, z) != true {
-		t.Fail()
-	}
-}
-
-func TestPatternEither(t *testing.T) {
-	p := newOption("-a", "", 0, false).transform()
-	q := newEither(newRequired(
-		newOption("-a", "", 0, false)))
-	if p.eq(q) != true {
-		t.Fail()
-	}
-
-	p = newArgument("A", nil).transform()
-	q = newEither(newRequired(
-		newArgument("A", nil)))
-	if p.eq(q) != true {
-		t.Fail()
-	}
-
-	p = newRequired(
-		newEither(
-			newOption("-a", "", 0, false),
-			newOption("-b", "", 0, false)),
-		newOption("-c", "", 0, false)).transform()
-	q = newEither(
-		newRequired(
-			newOption("-a", "", 0, false),
-			newOption("-c", "", 0, false)),
-		newRequired(
-			newOption("-b", "", 0, false),
-			newOption("-c", "", 0, false)))
-	if p.eq(q) != true {
-		t.Fail()
-	}
-
-	p = newOptional(newOption("-a", "", 0, false),
-		newEither(newOption("-b", "", 0, false),
-			newOption("-c", "", 0, false))).transform()
-	q = newEither(
-		newRequired(
-			newOption("-b", "", 0, false), newOption("-a", "", 0, false)),
-		newRequired(
-			newOption("-c", "", 0, false), newOption("-a", "", 0, false)))
-	if p.eq(q) != true {
-		t.Fail()
-	}
-
-	p = newEither(newOption("-x", "", 0, false),
-		newEither(newOption("-y", "", 0, false),
-			newOption("-z", "", 0, false))).transform()
-	q = newEither(
-		newRequired(newOption("-x", "", 0, false)),
-		newRequired(newOption("-y", "", 0, false)),
-		newRequired(newOption("-z", "", 0, false)))
-	if p.eq(q) != true {
-		t.Fail()
-	}
-
-	p = newOneOrMore(newArgument("N", nil),
-		newArgument("M", nil)).transform()
-	q = newEither(
-		newRequired(newArgument("N", nil), newArgument("M", nil),
-			newArgument("N", nil), newArgument("M", nil)))
-	if p.eq(q) != true {
-		t.Fail()
-	}
-}
-
-func TestPatternFixRepeatingArguments(t *testing.T) {
-	p := newOption("-a", "", 0, false)
-	p.fixRepeatingArguments()
-	if p.eq(newOption("-a", "", 0, false)) != true {
-		t.Fail()
-	}
-
-	p = newArgument("N", nil)
-	p.fixRepeatingArguments()
-	if p.eq(newArgument("N", nil)) != true {
-		t.Fail()
-	}
-
-	p = newRequired(
-		newArgument("N", nil),
-		newArgument("N", nil))
-	q := newRequired(
-		newArgument("N", []string{}),
-		newArgument("N", []string{}))
-	p.fixRepeatingArguments()
-	if p.eq(q) != true {
-		t.Fail()
-	}
-
-	p = newEither(
-		newArgument("N", nil),
-		newOneOrMore(newArgument("N", nil)))
-	q = newEither(
-		newArgument("N", []string{}),
-		newOneOrMore(newArgument("N", []string{})))
-	p.fix()
-	if p.eq(q) != true {
-		t.Fail()
-	}
-}
-
-func TestSet(t *testing.T) {
-	p := newArgument("N", nil)
-	q := newArgument("N", nil)
-	if reflect.DeepEqual(p, q) != true {
-		t.Fail()
-	}
-	pl := patternList{newArgument("N", nil), newArgument("N", nil)}
-	ql := patternList{newArgument("N", nil)}
-	if reflect.DeepEqual(pl.unique(), ql.unique()) != true {
-		t.Fail()
-	}
-}
-
-func TestPatternFixIdentities1(t *testing.T) {
-	p := newRequired(
-		newArgument("N", nil),
-		newArgument("N", nil))
-	if len(p.children) < 2 {
-		t.FailNow()
-	}
-	if p.children[0].eq(p.children[1]) != true {
-		t.Fail()
-	}
-	if p.children[0] == p.children[1] {
-		t.Fail()
-	}
-	p.fixIdentities(nil)
-	if p.children[0] != p.children[1] {
-		t.Fail()
-	}
-}
-
-func TestPatternFixIdentities2(t *testing.T) {
-	p := newRequired(
-		newOptional(
-			newArgument("X", nil),
-			newArgument("N", nil)),
-		newArgument("N", nil))
-	if len(p.children) < 2 {
-		t.FailNow()
-	}
-	if len(p.children[0].children) < 2 {
-		t.FailNow()
-	}
-	if p.children[0].children[1].eq(p.children[1]) != true {
-		t.Fail()
-	}
-	if p.children[0].children[1] == p.children[1] {
-		t.Fail()
-	}
-	p.fixIdentities(nil)
-	if p.children[0].children[1] != p.children[1] {
-		t.Fail()
-	}
-}
-
-func TestLongOptionsErrorHandling(t *testing.T) {
-	_, err := Parse("Usage: prog", []string{"--non-existent"}, true, "", false, false)
-	if _, ok := err.(*UserError); !ok {
-		t.Error(fmt.Sprintf("(%s) %s", reflect.TypeOf(err), err))
-	}
-	_, err = Parse("Usage: prog [--version --verbose]\nOptions: --version\n --verbose",
-		[]string{"--ver"}, true, "", false, false)
-	if _, ok := err.(*UserError); !ok {
-		t.Error(err)
-	}
-	_, err = Parse("Usage: prog --long\nOptions: --long ARG", []string{}, true, "", false, false)
-	if _, ok := err.(*LanguageError); !ok {
-		t.Error(err)
-	}
-	_, err = Parse("Usage: prog --long ARG\nOptions: --long ARG",
-		[]string{"--long"}, true, "", false, false)
-	if _, ok := err.(*UserError); !ok {
-		t.Error(fmt.Sprintf("(%s) %s", reflect.TypeOf(err), err))
-	}
-	_, err = Parse("Usage: prog --long=ARG\nOptions: --long", []string{}, true, "", false, false)
-	if _, ok := err.(*LanguageError); !ok {
-		t.Error(err)
-	}
-	_, err = Parse("Usage: prog --long\nOptions: --long",
-		[]string{}, true, "--long=ARG", false, false)
-	if _, ok := err.(*UserError); !ok {
-		t.Error(err)
-	}
-}
-
-func TestShortOptionsErrorHandling(t *testing.T) {
-	_, err := Parse("Usage: prog -x\nOptions: -x  this\n -x  that", []string{}, true, "", false, false)
-	if _, ok := err.(*LanguageError); !ok {
-		t.Error(fmt.Sprintf("(%s) %s", reflect.TypeOf(err), err))
-	}
-	_, err = Parse("Usage: prog", []string{"-x"}, true, "", false, false)
-	if _, ok := err.(*UserError); !ok {
-		t.Error(err)
-	}
-	_, err = Parse("Usage: prog -o\nOptions: -o ARG", []string{}, true, "", false, false)
-	if _, ok := err.(*LanguageError); !ok {
-		t.Error(err)
-	}
-	_, err = Parse("Usage: prog -o ARG\nOptions: -o ARG", []string{"-o"}, true, "", false, false)
-	if _, ok := err.(*UserError); !ok {
-		t.Error(err)
-	}
-}
-
-func TestMatchingParen(t *testing.T) {
-	_, err := Parse("Usage: prog [a [b]", []string{}, true, "", false, false)
-	if _, ok := err.(*LanguageError); !ok {
-		t.Error(err)
-	}
-	_, err = Parse("Usage: prog [a [b] ] c )", []string{}, true, "", false, false)
-	if _, ok := err.(*LanguageError); !ok {
-		t.Error(err)
-	}
-}
-
-func TestAllowDoubleDash(t *testing.T) {
-	if v, err := Parse("usage: prog [-o] [--] <arg>\noptions: -o", []string{"--", "-o"}, true, "", false, false); reflect.DeepEqual(v, map[string]interface{}{"-o": false, "<arg>": "-o", "--": true}) != true {
-		t.Error(err)
-	}
-	if v, err := Parse("usage: prog [-o] [--] <arg>\noptions: -o", []string{"-o", "1"}, true, "", false, false); reflect.DeepEqual(v, map[string]interface{}{"-o": true, "<arg>": "1", "--": false}) != true {
-		t.Error(err)
-	}
-	_, err := Parse("usage: prog [-o] <arg>\noptions:-o", []string{"-o"}, true, "", false, false)
-	if _, ok := err.(*UserError); !ok { //"--" is not allowed; FIXME?
-		t.Error(err)
-	}
-}
-
-func TestDocopt(t *testing.T) {
-	doc := `Usage: prog [-v] A
-
-                Options: -v  Be verbose.`
-	if v, err := Parse(doc, []string{"arg"}, true, "", false, false); reflect.DeepEqual(v, map[string]interface{}{"-v": false, "A": "arg"}) != true {
-		t.Error(err)
-	}
-	if v, err := Parse(doc, []string{"-v", "arg"}, true, "", false, false); reflect.DeepEqual(v, map[string]interface{}{"-v": true, "A": "arg"}) != true {
-		t.Error(err)
-	}
-
-	doc = `Usage: prog [-vqr] [FILE]
-              prog INPUT OUTPUT
-              prog --help
-
-    Options:
-      -v  print status messages
-      -q  report only file names
-      -r  show all occurrences of the same error
-      --help
-
-    `
-	if v, err := Parse(doc, []string{"-v", "file.py"}, true, "", false, false); reflect.DeepEqual(v, map[string]interface{}{"-v": true, "-q": false, "-r": false, "--help": false, "FILE": "file.py", "INPUT": nil, "OUTPUT": nil}) != true {
-		t.Error(err)
-	}
-	if v, err := Parse(doc, []string{"-v"}, true, "", false, false); reflect.DeepEqual(v, map[string]interface{}{"-v": true, "-q": false, "-r": false, "--help": false, "FILE": nil, "INPUT": nil, "OUTPUT": nil}) != true {
-		t.Error(err)
-	}
-
-	_, err := Parse(doc, []string{"-v", "input.py", "output.py"}, true, "", false, false) // does not match
-	if _, ok := err.(*UserError); !ok {
-		t.Error(err)
-	}
-	_, err = Parse(doc, []string{"--fake"}, true, "", false, false)
-	if _, ok := err.(*UserError); !ok {
-		t.Error(err)
-	}
-	_, output, err := parseOutput(doc, []string{"--hel"}, true, "", false)
-	if err != nil || len(output) == 0 {
-		t.Error(err)
-	}
-}
-
-func TestLanguageErrors(t *testing.T) {
-	_, err := Parse("no usage with colon here", []string{}, true, "", false, false)
-	if _, ok := err.(*LanguageError); !ok {
-		t.Error(err)
-	}
-	_, err = Parse("usage: here \n\n and again usage: here", []string{}, true, "", false, false)
-	if _, ok := err.(*LanguageError); !ok {
-		t.Error(err)
-	}
-}
-
-func TestIssue40(t *testing.T) {
-	_, output, err := parseOutput("usage: prog --help-commands | --help", []string{"--help"}, true, "", false)
-	if err != nil || len(output) == 0 {
-		t.Error(err)
-	}
-	if v, err := Parse("usage: prog --aabb | --aa", []string{"--aa"}, true, "", false, false); reflect.DeepEqual(v, map[string]interface{}{"--aabb": false, "--aa": true}) != true {
-		t.Error(err)
-	}
-}
-
-func TestIssue34UnicodeStrings(t *testing.T) {
-	// TODO: see if applicable
-}
-
-func TestCountMultipleFlags(t *testing.T) {
-	if v, err := Parse("usage: prog [-v]", []string{"-v"}, true, "", false, false); reflect.DeepEqual(v, map[string]interface{}{"-v": true}) != true {
-		t.Error(err)
-	}
-	if v, err := Parse("usage: prog [-vv]", []string{}, true, "", false, false); reflect.DeepEqual(v, map[string]interface{}{"-v": 0}) != true {
-		t.Error(err)
-	}
-	if v, err := Parse("usage: prog [-vv]", []string{"-v"}, true, "", false, false); reflect.DeepEqual(v, map[string]interface{}{"-v": 1}) != true {
-		t.Error(err)
-	}
-	if v, err := Parse("usage: prog [-vv]", []string{"-vv"}, true, "", false, false); reflect.DeepEqual(v, map[string]interface{}{"-v": 2}) != true {
-		t.Error(err)
-	}
-	_, err := Parse("usage: prog [-vv]", []string{"-vvv"}, true, "", false, false)
-	if _, ok := err.(*UserError); !ok {
-		t.Error(err)
-	}
-	if v, err := Parse("usage: prog [-v | -vv | -vvv]", []string{"-vvv"}, true, "", false, false); reflect.DeepEqual(v, map[string]interface{}{"-v": 3}) != true {
-		t.Error(err)
-	}
-	if v, err := Parse("usage: prog [-v...]", []string{"-vvvvvv"}, true, "", false, false); reflect.DeepEqual(v, map[string]interface{}{"-v": 6}) != true {
-		t.Error(err)
-	}
-	if v, err := Parse("usage: prog [--ver --ver]", []string{"--ver", "--ver"}, true, "", false, false); reflect.DeepEqual(v, map[string]interface{}{"--ver": 2}) != true {
-		t.Error(err)
-	}
-}
-
-func TestAnyOptionsParameter(t *testing.T) {
-	_, err := Parse("usage: prog [options]",
-		[]string{"-foo", "--bar", "--spam=eggs"}, true, "", false, false)
-	if _, ok := err.(*UserError); !ok {
-		t.Fail()
-	}
-
-	_, err = Parse("usage: prog [options]",
-		[]string{"--foo", "--bar", "--bar"}, true, "", false, false)
-	if _, ok := err.(*UserError); !ok {
-		t.Fail()
-	}
-	_, err = Parse("usage: prog [options]",
-		[]string{"--bar", "--bar", "--bar", "-ffff"}, true, "", false, false)
-	if _, ok := err.(*UserError); !ok {
-		t.Fail()
-	}
-	_, err = Parse("usage: prog [options]",
-		[]string{"--long=arg", "--long=another"}, true, "", false, false)
-	if _, ok := err.(*UserError); !ok {
-		t.Fail()
-	}
-}
-
-func TestDefaultValueForPositionalArguments(t *testing.T) {
-	doc := "Usage: prog [--data=<data>...]\nOptions:\n\t-d --data=<arg>    Input data [default: x]"
-	if v, err := Parse(doc, []string{}, true, "", false, false); reflect.DeepEqual(v, map[string]interface{}{"--data": []string{"x"}}) != true {
-		t.Error(err)
-	}
-
-	doc = "Usage: prog [--data=<data>...]\nOptions:\n\t-d --data=<arg>    Input data [default: x y]"
-	if v, err := Parse(doc, []string{}, true, "", false, false); reflect.DeepEqual(v, map[string]interface{}{"--data": []string{"x", "y"}}) != true {
-		t.Error(err)
-	}
-
-	doc = "Usage: prog [--data=<data>...]\nOptions:\n\t-d --data=<arg>    Input data [default: x y]"
-	if v, err := Parse(doc, []string{"--data=this"}, true, "", false, false); reflect.DeepEqual(v, map[string]interface{}{"--data": []string{"this"}}) != true {
-		t.Error(err)
-	}
-}
-
-func TestIssue59(t *testing.T) {
-	if v, err := Parse("usage: prog --long=<a>", []string{"--long="}, true, "", false, false); reflect.DeepEqual(v, map[string]interface{}{"--long": ""}) != true {
-		t.Error(err)
-	}
-
-	if v, err := Parse("usage: prog -l <a>\noptions: -l <a>", []string{"-l", ""}, true, "", false, false); reflect.DeepEqual(v, map[string]interface{}{"-l": ""}) != true {
-		t.Error(err)
-	}
-}
-
-func TestOptionsFirst(t *testing.T) {
-	if v, err := Parse("usage: prog [--opt] [<args>...]", []string{"--opt", "this", "that"}, true, "", false, false); reflect.DeepEqual(v, map[string]interface{}{"--opt": true, "<args>": []string{"this", "that"}}) != true {
-		t.Error(err)
-	}
-
-	if v, err := Parse("usage: prog [--opt] [<args>...]", []string{"this", "that", "--opt"}, true, "", false, false); reflect.DeepEqual(v, map[string]interface{}{"--opt": true, "<args>": []string{"this", "that"}}) != true {
-		t.Error(err)
-	}
-
-	if v, err := Parse("usage: prog [--opt] [<args>...]", []string{"this", "that", "--opt"}, true, "", true, false); reflect.DeepEqual(v, map[string]interface{}{"--opt": false, "<args>": []string{"this", "that", "--opt"}}) != true {
-		t.Error(err)
-	}
-}
-
-func TestIssue68OptionsShortcutDoesNotIncludeOptionsInUsagePattern(t *testing.T) {
-	args, err := Parse("usage: prog [-ab] [options]\noptions: -x\n -y", []string{"-ax"}, true, "", false, false)
-
-	if args["-a"] != true {
-		t.Error(err)
-	}
-	if args["-b"] != false {
-		t.Error(err)
-	}
-	if args["-x"] != true {
-		t.Error(err)
-	}
-	if args["-y"] != false {
-		t.Error(err)
-	}
-}
-
-func TestIssue65EvaluateArgvWhenCalledNotWhenImported(t *testing.T) {
-	os.Args = strings.Fields("prog -a")
-	v, err := Parse("usage: prog [-ab]", nil, true, "", false, false)
-	w := map[string]interface{}{"-a": true, "-b": false}
-	if reflect.DeepEqual(v, w) != true {
-		t.Error(err)
-	}
-
-	os.Args = strings.Fields("prog -b")
-	v, err = Parse("usage: prog [-ab]", nil, true, "", false, false)
-	w = map[string]interface{}{"-a": false, "-b": true}
-	if reflect.DeepEqual(v, w) != true {
-		t.Error(err)
-	}
-}
-
-func TestIssue71DoubleDashIsNotAValidOptionArgument(t *testing.T) {
-	_, err := Parse("usage: prog [--log=LEVEL] [--] <args>...",
-		[]string{"--log", "--", "1", "2"}, true, "", false, false)
-	if _, ok := err.(*UserError); !ok {
-		t.Fail()
-	}
-
-	_, err = Parse(`usage: prog [-l LEVEL] [--] <args>...
-                  options: -l LEVEL`, []string{"-l", "--", "1", "2"}, true, "", false, false)
-	if _, ok := err.(*UserError); !ok {
-		t.Fail()
-	}
-}
-
-func TestParseSection(t *testing.T) {
-	v := parseSection("usage:", "foo bar fizz buzz")
-	w := []string{}
-	if reflect.DeepEqual(v, w) != true {
-		t.Fail()
-	}
-
-	v = parseSection("usage:", "usage: prog")
-	w = []string{"usage: prog"}
-	if reflect.DeepEqual(v, w) != true {
-		t.Fail()
-	}
-
-	v = parseSection("usage:", "usage: -x\n -y")
-	w = []string{"usage: -x\n -y"}
-	if reflect.DeepEqual(v, w) != true {
-		t.Fail()
-	}
-
-	usage := `usage: this
-
-usage:hai
-usage: this that
-
-usage: foo
-       bar
-
-PROGRAM USAGE:
- foo
- bar
-usage:
-` + "\t" + `too
-` + "\t" + `tar
-Usage: eggs spam
-BAZZ
-usage: pit stop`
-
-	v = parseSection("usage:", usage)
-	w = []string{"usage: this",
-		"usage:hai",
-		"usage: this that",
-		"usage: foo\n       bar",
-		"PROGRAM USAGE:\n foo\n bar",
-		"usage:\n\ttoo\n\ttar",
-		"Usage: eggs spam",
-		"usage: pit stop",
-	}
-	if reflect.DeepEqual(v, w) != true {
-		t.Fail()
-	}
-}
-
-func TestIssue126DefaultsNotParsedCorrectlyWhenTabs(t *testing.T) {
-	section := "Options:\n\t--foo=<arg>  [default: bar]"
-	v := patternList{newOption("", "--foo", 1, "bar")}
-	if reflect.DeepEqual(parseDefaults(section), v) != true {
-		t.Fail()
-	}
-}
-
-// conf file based test cases
-func TestFileTestcases(t *testing.T) {
-	filenames := []string{"testcases.docopt", "test_golang.docopt"}
-	for _, filename := range filenames {
-		raw, err := ioutil.ReadFile(filename)
-		if err != nil {
-			t.Fatal(err)
-		}
-
-		tests, err := parseTest(raw)
-		if err != nil {
-			t.Fatal(err)
-		}
-		for _, c := range tests {
-			result, err := Parse(c.doc, c.argv, true, "", false, false)
-			if _, ok := err.(*UserError); c.userError && !ok {
-				// expected a user-error
-				t.Error("testcase:", c.id, "result:", result)
-			} else if _, ok := err.(*UserError); !c.userError && ok {
-				// unexpected user-error
-				t.Error("testcase:", c.id, "error:", err, "result:", result)
-			} else if reflect.DeepEqual(c.expect, result) != true {
-				t.Error("testcase:", c.id, "result:", result, "expect:", c.expect)
-			}
-		}
-	}
-}
-
-type testcase struct {
-	id        int
-	doc       string
-	prog      string
-	argv      []string
-	expect    map[string]interface{}
-	userError bool
-}
-
-func parseTest(raw []byte) ([]testcase, error) {
-	var res []testcase
-	commentPattern := regexp.MustCompile("#.*")
-	raw = commentPattern.ReplaceAll(raw, []byte(""))
-	raw = bytes.TrimSpace(raw)
-	if bytes.HasPrefix(raw, []byte(`"""`)) {
-		raw = raw[3:]
-	}
-
-	id := 0
-	for _, fixture := range bytes.Split(raw, []byte(`r"""`)) {
-		doc, _, body := stringPartition(string(fixture), `"""`)
-		for _, cas := range strings.Split(body, "$")[1:] {
-			argvString, _, expectString := stringPartition(strings.TrimSpace(cas), "\n")
-			prog, _, argvString := stringPartition(strings.TrimSpace(argvString), " ")
-			argv := []string{}
-			if len(argvString) > 0 {
-				argv = strings.Fields(argvString)
-			}
-			var expectUntyped interface{}
-			err := json.Unmarshal([]byte(expectString), &expectUntyped)
-			if err != nil {
-				return nil, err
-			}
-			switch expect := expectUntyped.(type) {
-			case string: // user-error
-				res = append(res, testcase{id, doc, prog, argv, nil, true})
-			case map[string]interface{}:
-				// convert []interface{} values to []string
-				// convert float64 values to int
-				for k, vUntyped := range expect {
-					switch v := vUntyped.(type) {
-					case []interface{}:
-						itemList := make([]string, len(v))
-						for i, itemUntyped := range v {
-							if item, ok := itemUntyped.(string); ok {
-								itemList[i] = item
-							}
-						}
-						expect[k] = itemList
-					case float64:
-						expect[k] = int(v)
-					}
-				}
-				res = append(res, testcase{id, doc, prog, argv, expect, false})
-			default:
-				return nil, fmt.Errorf("unhandled json data type")
-			}
-			id++
-		}
-	}
-	return res, nil
-}
-
-// parseOutput wraps the Parse() function to also return stdout
-func parseOutput(doc string, argv []string, help bool, version string,
-	optionsFirst bool) (map[string]interface{}, string, error) {
-	stdout := os.Stdout
-	r, w, _ := os.Pipe()
-	os.Stdout = w
-
-	args, err := Parse(doc, argv, help, version, optionsFirst, false)
-
-	outChan := make(chan string)
-	go func() {
-		var buf bytes.Buffer
-		io.Copy(&buf, r)
-		outChan <- buf.String()
-	}()
-
-	w.Close()
-	os.Stdout = stdout
-	output := <-outChan
-
-	return args, output, err
-}
-
-var debugEnabled = false
-
-func debugOn(l ...interface{}) {
-	debugEnabled = true
-	debug(l...)
-}
-func debugOff(l ...interface{}) {
-	debug(l...)
-	debugEnabled = false
-}
-
-func debug(l ...interface{}) {
-	if debugEnabled {
-		fmt.Println(l...)
-	}
-}

+ 0 - 37
vendor/github.com/docopt/docopt-go/example_test.go

@@ -1,37 +0,0 @@
-package docopt
-
-import (
-	"fmt"
-	"sort"
-)
-
-func ExampleParse() {
-	usage := `Usage:
-  config_example tcp [<host>] [--force] [--timeout=<seconds>]
-  config_example serial <port> [--baud=<rate>] [--timeout=<seconds>]
-  config_example -h | --help | --version`
-	// parse the command line `comfig_example tcp 127.0.0.1 --force`
-	argv := []string{"tcp", "127.0.0.1", "--force"}
-	arguments, _ := Parse(usage, argv, true, "0.1.1rc", false)
-	// sort the keys of the arguments map
-	var keys []string
-	for k := range arguments {
-		keys = append(keys, k)
-	}
-	sort.Strings(keys)
-	// print the argument keys and values
-	for _, k := range keys {
-		fmt.Printf("%9s %v\n", k, arguments[k])
-	}
-	// output:
-	//    --baud <nil>
-	//   --force true
-	//    --help false
-	// --timeout <nil>
-	// --version false
-	//        -h false
-	//    <host> 127.0.0.1
-	//    <port> <nil>
-	//    serial false
-	//       tcp true
-}

+ 0 - 29
vendor/github.com/docopt/docopt-go/examples/arguments/arguments_example.go

@@ -1,29 +0,0 @@
-package main
-
-import (
-	"fmt"
-	"github.com/docopt/docopt-go"
-)
-
-func main() {
-	usage := `Usage: arguments_example [-vqrh] [FILE] ...
-       arguments_example (--left | --right) CORRECTION FILE
-
-Process FILE and optionally apply correction to either left-hand side or
-right-hand side.
-
-Arguments:
-  FILE        optional input file
-  CORRECTION  correction angle, needs FILE, --left or --right to be present
-
-Options:
-  -h --help
-  -v       verbose mode
-  -q       quiet mode
-  -r       make report
-  --left   use left-hand side
-  --right  use right-hand side`
-
-	arguments, _ := docopt.Parse(usage, nil, true, "", false)
-	fmt.Println(arguments)
-}

+ 0 - 26
vendor/github.com/docopt/docopt-go/examples/calculator/calculator_example.go

@@ -1,26 +0,0 @@
-package main
-
-import (
-	"fmt"
-	"github.com/docopt/docopt-go"
-)
-
-func main() {
-	usage := `Not a serious example.
-
-Usage:
-  calculator_example <value> ( ( + | - | * | / ) <value> )...
-  calculator_example <function> <value> [( , <value> )]...
-  calculator_example (-h | --help)
-
-Examples:
-  calculator_example 1 + 2 + 3 + 4 + 5
-  calculator_example 1 + 2 '*' 3 / 4 - 5    # note quotes around '*'
-  calculator_example sum 10 , 20 , 30 , 40
-
-Options:
-  -h, --help
-`
-	arguments, _ := docopt.Parse(usage, nil, true, "", false)
-	fmt.Println(arguments)
-}

+ 0 - 76
vendor/github.com/docopt/docopt-go/examples/config_file/config_file_example.go

@@ -1,76 +0,0 @@
-package main
-
-import (
-	"encoding/json"
-	"fmt"
-	"github.com/docopt/docopt-go"
-	"strings"
-)
-
-func loadJSONConfig() map[string]interface{} {
-	var result map[string]interface{}
-	jsonData := []byte(`{"--force": true, "--timeout": "10", "--baud": "9600"}`)
-	json.Unmarshal(jsonData, &result)
-	return result
-}
-
-func loadIniConfig() map[string]interface{} {
-	iniData := `
-[default-arguments]
---force
---baud=19200
-<host>=localhost`
-	// trivial ini parser
-	// default value for an item is bool: true (for --force)
-	// otherwise the value is a string
-	iniParsed := make(map[string]map[string]interface{})
-	var section string
-	for _, line := range strings.Split(iniData, "\n") {
-		if strings.HasPrefix(line, "[") {
-			section = line
-			iniParsed[section] = make(map[string]interface{})
-		} else if section != "" {
-			kv := strings.SplitN(line, "=", 2)
-			if len(kv) == 1 {
-				iniParsed[section][kv[0]] = true
-			} else if len(kv) == 2 {
-				iniParsed[section][kv[0]] = kv[1]
-			}
-		}
-	}
-	return iniParsed["[default-arguments]"]
-}
-
-// merge combines two maps.
-// truthiness takes priority over falsiness
-// mapA takes priority over mapB
-func merge(mapA, mapB map[string]interface{}) map[string]interface{} {
-	result := make(map[string]interface{})
-	for k, v := range mapA {
-		result[k] = v
-	}
-	for k, v := range mapB {
-		if _, ok := result[k]; !ok || result[k] == nil || result[k] == false {
-			result[k] = v
-		}
-	}
-	return result
-}
-
-func main() {
-	usage := `Usage:
-  config_file_example tcp [<host>] [--force] [--timeout=<seconds>]
-  config_file_example serial <port> [--baud=<rate>] [--timeout=<seconds>]
-  config_file_example -h | --help | --version`
-
-	jsonConfig := loadJSONConfig()
-	iniConfig := loadIniConfig()
-	arguments, _ := docopt.Parse(usage, nil, true, "0.1.1rc", false)
-
-	// Arguments take priority over INI, INI takes priority over JSON
-	result := merge(arguments, merge(iniConfig, jsonConfig))
-
-	fmt.Println("JSON config: ", jsonConfig)
-	fmt.Println("INI config: ", iniConfig)
-	fmt.Println("Result: ", result)
-}

+ 0 - 22
vendor/github.com/docopt/docopt-go/examples/counted/counted_example.go

@@ -1,22 +0,0 @@
-package main
-
-import (
-	"fmt"
-	"github.com/docopt/docopt-go"
-)
-
-func main() {
-	usage := `Usage: counted_example --help
-       counted_example -v...
-       counted_example go [go]
-       counted_example (--path=<path>)...
-       counted_example <file> <file>
-
-Try: counted_example -vvvvvvvvvv
-     counted_example go go
-     counted_example --path ./here --path ./there
-     counted_example this.txt that.txt`
-
-	arguments, _ := docopt.Parse(usage, nil, true, "", false)
-	fmt.Println(arguments)
-}

+ 0 - 38
vendor/github.com/docopt/docopt-go/examples/git/branch/git_branch.go

@@ -1,38 +0,0 @@
-package git
-
-import (
-	"fmt"
-	"github.com/docopt/docopt-go"
-)
-
-func main() {
-	usage := `usage: git branch [options] [-r | -a] [--merged=<commit> | --no-merged=<commit>]
-       git branch [options] [-l] [-f] <branchname> [<start-point>]
-       git branch [options] [-r] (-d | -D) <branchname>
-       git branch [options] (-m | -M) [<oldbranch>] <newbranch>
-
-Generic options:
-    -h, --help
-    -v, --verbose         show hash and subject, give twice for upstream branch
-    -t, --track           set up tracking mode (see git-pull(1))
-    --set-upstream        change upstream info
-    --color=<when>        use colored output
-    -r                    act on remote-tracking branches
-    --contains=<commit>   print only branches that contain the commit
-    --abbrev=<n>          use <n> digits to display SHA-1s
-
-Specific git-branch actions:
-    -a                    list both remote-tracking and local branches
-    -d                    delete fully merged branch
-    -D                    delete branch (even if not merged)
-    -m                    move/rename a branch and its reflog
-    -M                    move/rename a branch, even if target exists
-    -l                    create the branch's reflog
-    -f, --force           force creation (when already exists)
-    --no-merged=<commit>  print only not merged branches
-    --merged=<commit>     print only merged branches
-`
-
-	args, _ := docopt.Parse(usage, nil, true, "", false)
-	fmt.Println(args)
-}

+ 0 - 30
vendor/github.com/docopt/docopt-go/examples/git/checkout/git_checkout.go

@@ -1,30 +0,0 @@
-package git
-
-import (
-	"fmt"
-	"github.com/docopt/docopt-go"
-)
-
-func main() {
-	usage := `usage: git checkout [options] <branch>
-       git checkout [options] <branch> -- <file>...
-
-options:
-    -q, --quiet           suppress progress reporting
-    -b <branch>           create and checkout a new branch
-    -B <branch>           create/reset and checkout a branch
-    -l                    create reflog for new branch
-    -t, --track           set upstream info for new branch
-    --orphan <new branch>
-                          new unparented branch
-    -2, --ours            checkout our version for unmerged files
-    -3, --theirs          checkout their version for unmerged files
-    -f, --force           force checkout (throw away local modifications)
-    -m, --merge           perform a 3-way merge with the new branch
-    --conflict <style>    conflict style (merge or diff3)
-    -p, --patch           select hunks interactively
-`
-
-	args, _ := docopt.Parse(usage, nil, true, "", false)
-	fmt.Println(args)
-}

+ 0 - 37
vendor/github.com/docopt/docopt-go/examples/git/clone/git_clone.go

@@ -1,37 +0,0 @@
-package git
-
-import (
-	"fmt"
-	"github.com/docopt/docopt-go"
-)
-
-func main() {
-	usage := `usage: git clone [options] [--] <repo> [<dir>]
-
-options:
-    -v, --verbose         be more verbose
-    -q, --quiet           be more quiet
-    --progress            force progress reporting
-    -n, --no-checkout     don't create a checkout
-    --bare                create a bare repository
-    --mirror              create a mirror repository (implies bare)
-    -l, --local           to clone from a local repository
-    --no-hardlinks        don't use local hardlinks, always copy
-    -s, --shared          setup as shared repository
-    --recursive           initialize submodules in the clone
-    --recurse-submodules  initialize submodules in the clone
-    --template <template-directory>
-                          directory from which templates will be used
-    --reference <repo>    reference repository
-    -o, --origin <branch>
-                          use <branch> instead of 'origin' to track upstream
-    -b, --branch <branch>
-                          checkout <branch> instead of the remote's HEAD
-    -u, --upload-pack <path>
-                          path to git-upload-pack on the remote
-    --depth <depth>       create a shallow clone of that depth
-`
-
-	args, _ := docopt.Parse(usage, nil, true, "", false)
-	fmt.Println(args)
-}

+ 0 - 108
vendor/github.com/docopt/docopt-go/examples/git/git.go

@@ -1,108 +0,0 @@
-package main
-
-import (
-	"fmt"
-	"github.com/docopt/docopt-go"
-	"os"
-	"os/exec"
-)
-
-func main() {
-	usage := `usage: git [--version] [--exec-path=<path>] [--html-path]
-           [-p|--paginate|--no-pager] [--no-replace-objects]
-           [--bare] [--git-dir=<path>] [--work-tree=<path>]
-           [-c <name>=<value>] [--help]
-           <command> [<args>...]
-
-options:
-   -c <name=value>
-   -h, --help
-   -p, --paginate
-
-The most commonly used git commands are:
-   add        Add file contents to the index
-   branch     List, create, or delete branches
-   checkout   Checkout a branch or paths to the working tree
-   clone      Clone a repository into a new directory
-   commit     Record changes to the repository
-   push       Update remote refs along with associated objects
-   remote     Manage set of tracked repositories
-
-See 'git help <command>' for more information on a specific command.
-`
-	args, _ := docopt.Parse(usage, nil, true, "git version 1.7.4.4", true)
-
-	fmt.Println("global arguments:")
-	fmt.Println(args)
-
-	fmt.Println("command arguments:")
-	cmd := args["<command>"].(string)
-	cmdArgs := args["<args>"].([]string)
-
-	err := runCommand(cmd, cmdArgs)
-	if err != nil {
-		fmt.Println(err)
-		os.Exit(1)
-	}
-}
-
-func goRun(scriptName string, args []string) (err error) {
-	cmdArgs := make([]string, 2)
-	cmdArgs[0] = "run"
-	cmdArgs[1] = scriptName
-	cmdArgs = append(cmdArgs, args...)
-	osCmd := exec.Command("go", cmdArgs...)
-	var out []byte
-	out, err = osCmd.Output()
-	fmt.Println(string(out))
-	if err != nil {
-		return
-	}
-	return
-}
-
-func runCommand(cmd string, args []string) (err error) {
-	argv := make([]string, 1)
-	argv[0] = cmd
-	argv = append(argv, args...)
-	switch cmd {
-	case "add":
-		// subcommand is a function call
-		return cmdAdd(argv)
-	case "branch":
-		// subcommand is a script
-		return goRun("branch/git_branch.go", argv)
-	case "checkout", "clone", "commit", "push", "remote":
-		// subcommand is a script
-		scriptName := fmt.Sprintf("%s/git_%s.go", cmd, cmd)
-		return goRun(scriptName, argv)
-	case "help", "":
-		return goRun("git.go", []string{"git_add.go", "--help"})
-	}
-
-	return fmt.Errorf("%s is not a git command. See 'git help'", cmd)
-}
-
-func cmdAdd(argv []string) (err error) {
-	usage := `usage: git add [options] [--] [<filepattern>...]
-
-options:
-	-h, --help
-	-n, --dry-run        dry run
-	-v, --verbose        be verbose
-	-i, --interactive    interactive picking
-	-p, --patch          select hunks interactively
-	-e, --edit           edit current diff and apply
-	-f, --force          allow adding otherwise ignored files
-	-u, --update         update tracked files
-	-N, --intent-to-add  record only the fact that the path will be added later
-	-A, --all            add all, noticing removal of tracked files
-	--refresh            don't add, only refresh the index
-	--ignore-errors      just skip files which cannot be added because of errors
-	--ignore-missing     check if - even missing - files are ignored in dry run
-`
-
-	args, _ := docopt.Parse(usage, nil, true, "", false)
-	fmt.Println(args)
-	return
-}

+ 0 - 34
vendor/github.com/docopt/docopt-go/examples/git/push/git_push.go

@@ -1,34 +0,0 @@
-package git
-
-import (
-	"fmt"
-	"github.com/docopt/docopt-go"
-)
-
-func main() {
-	usage := `usage: git push [options] [<repository> [<refspec>...]]
-
-options:
-    -h, --help
-    -v, --verbose         be more verbose
-    -q, --quiet           be more quiet
-    --repo <repository>   repository
-    --all                 push all refs
-    --mirror              mirror all refs
-    --delete              delete refs
-    --tags                push tags (can't be used with --all or --mirror)
-    -n, --dry-run         dry run
-    --porcelain           machine-readable output
-    -f, --force           force updates
-    --thin                use thin pack
-    --receive-pack <receive-pack>
-                          receive pack program
-    --exec <receive-pack>
-                          receive pack program
-    -u, --set-upstream    set upstream for git pull/status
-    --progress            force progress reporting
-`
-
-	args, _ := docopt.Parse(usage, nil, true, "", false)
-	fmt.Println(args)
-}

+ 0 - 28
vendor/github.com/docopt/docopt-go/examples/git/remote/git_remote.go

@@ -1,28 +0,0 @@
-package git
-
-import (
-	"fmt"
-	"github.com/docopt/docopt-go"
-)
-
-func main() {
-	usage := `usage: git remote [-v | --verbose]
-       git remote add [-t <branch>] [-m <master>] [-f] [--mirror] <name> <url>
-       git remote rename <old> <new>
-       git remote rm <name>
-       git remote set-head <name> (-a | -d | <branch>)
-       git remote [-v | --verbose] show [-n] <name>
-       git remote prune [-n | --dry-run] <name>
-       git remote [-v | --verbose] update [-p | --prune] [(<group> | <remote>)...]
-       git remote set-branches <name> [--add] <branch>...
-       git remote set-url <name> <newurl> [<oldurl>]
-       git remote set-url --add <name> <newurl>
-       git remote set-url --delete <name> <url>
-
-options:
-    -v, --verbose         be verbose; must be placed before a subcommand
-`
-
-	args, _ := docopt.Parse(usage, nil, true, "", false)
-	fmt.Println(args)
-}

+ 0 - 28
vendor/github.com/docopt/docopt-go/examples/naval_fate/naval_fate.go

@@ -1,28 +0,0 @@
-package main
-
-import (
-	"fmt"
-	"github.com/docopt/docopt-go"
-)
-
-func main() {
-	usage := `Naval Fate.
-
-Usage:
-  naval_fate ship new <name>...
-  naval_fate ship <name> move <x> <y> [--speed=<kn>]
-  naval_fate ship shoot <x> <y>
-  naval_fate mine (set|remove) <x> <y> [--moored|--drifting]
-  naval_fate -h | --help
-  naval_fate --version
-
-Options:
-  -h --help     Show this screen.
-  --version     Show version.
-  --speed=<kn>  Speed in knots [default: 10].
-  --moored      Moored (anchored) mine.
-  --drifting    Drifting mine.`
-
-	arguments, _ := docopt.Parse(usage, nil, true, "Naval Fate 2.0", false)
-	fmt.Println(arguments)
-}

+ 0 - 19
vendor/github.com/docopt/docopt-go/examples/odd_even/odd_even_example.go

@@ -1,19 +0,0 @@
-package main
-
-import (
-	"fmt"
-	"github.com/docopt/docopt-go"
-)
-
-func main() {
-	usage := `Usage: odd_even_example [-h | --help] (ODD EVEN)...
-
-Example, try:
-  odd_even_example 1 2 3 4
-
-Options:
-  -h, --help`
-
-	arguments, _ := docopt.Parse(usage, nil, true, "", false)
-	fmt.Println(arguments)
-}

+ 0 - 43
vendor/github.com/docopt/docopt-go/examples/options/options_example.go

@@ -1,43 +0,0 @@
-package main
-
-import (
-	"fmt"
-	"github.com/docopt/docopt-go"
-)
-
-func main() {
-	usage := `Example of program with many options using docopt.
-
-Usage:
-  options_example [-hvqrf NAME] [--exclude=PATTERNS]
-                     [--select=ERRORS | --ignore=ERRORS] [--show-source]
-                     [--statistics] [--count] [--benchmark] PATH...
-  options_example (--doctest | --testsuite=DIR)
-  options_example --version
-
-Arguments:
-  PATH  destination path
-
-Options:
-  -h --help            show this help message and exit
-  --version            show version and exit
-  -v --verbose         print status messages
-  -q --quiet           report only file names
-  -r --repeat          show all occurrences of the same error
-  --exclude=PATTERNS   exclude files or directories which match these comma
-                       separated patterns [default: .svn,CVS,.bzr,.hg,.git]
-  -f NAME --file=NAME  when parsing directories, only check filenames matching
-                       these comma separated patterns [default: *.go]
-  --select=ERRORS      select errors and warnings (e.g. E,W6)
-  --ignore=ERRORS      skip errors and warnings (e.g. E4,W)
-  --show-source        show source code for each error
-  --statistics         count errors and warnings
-  --count              print total number of errors and warnings to standard
-                       error and set exit code to 1 if total is not null
-  --benchmark          measure processing speed
-  --testsuite=DIR      run regression tests from dir
-  --doctest            run doctest on myself`
-
-	arguments, _ := docopt.Parse(usage, nil, true, "1.0.0rc2", false)
-	fmt.Println(arguments)
-}

+ 0 - 24
vendor/github.com/docopt/docopt-go/examples/options_shortcut/options_shortcut_example.go

@@ -1,24 +0,0 @@
-package main
-
-import (
-	"fmt"
-	"github.com/docopt/docopt-go"
-)
-
-func main() {
-	usage := `Example of program which uses [options] shortcut in pattern.
-
-Usage:
-  options_shortcut_example [options] <port>
-
-Options:
-  -h --help                show this help message and exit
-  --version                show version and exit
-  -n, --number N           use N as a number
-  -t, --timeout TIMEOUT    set timeout TIMEOUT seconds
-  --apply                  apply changes to database
-  -q                       operate in quiet mode`
-
-	arguments, _ := docopt.Parse(usage, nil, true, "1.0.0rc2", false)
-	fmt.Println(arguments)
-}

+ 0 - 16
vendor/github.com/docopt/docopt-go/examples/quick/quick_example.go

@@ -1,16 +0,0 @@
-package main
-
-import (
-	"fmt"
-	"github.com/docopt/docopt-go"
-)
-
-func main() {
-	usage := `Usage:
-  quick_example tcp <host> <port> [--timeout=<seconds>]
-  quick_example serial <port> [--baud=9600] [--timeout=<seconds>]
-  quick_example -h | --help | --version`
-
-	arguments, _ := docopt.Parse(usage, nil, true, "0.1.1rc", false)
-	fmt.Println(arguments)
-}

+ 0 - 31
vendor/github.com/docopt/docopt-go/examples/type_assert/type_assert_example.go

@@ -1,31 +0,0 @@
-package main
-
-import (
-	"fmt"
-	"github.com/docopt/docopt-go"
-)
-
-func main() {
-	usage := `usage: foo [-x] [-y]`
-
-	arguments, err := docopt.Parse(usage, nil, true, "", false)
-	if err != nil {
-		fmt.Println(err)
-	}
-
-	fmt.Println(arguments)
-
-	var x = arguments["-x"].(bool) // type assertion required
-	if x == true {
-		fmt.Println("x is true")
-	}
-
-	y := arguments["-y"] // no type assertion needed
-	if y == true {
-		fmt.Println("y is true")
-	}
-	y2 := arguments["-y"]
-	if y2 == 10 { // this will never be true, a type assertion would have produced a build error
-		fmt.Println("y is 10")
-	}
-}

+ 0 - 9
vendor/github.com/docopt/docopt-go/test_golang.docopt

@@ -1,9 +0,0 @@
-r"""usage: prog [NAME_-2]..."""
-$ prog 10 20
-{"NAME_-2": ["10", "20"]}
-
-$ prog 10
-{"NAME_-2": ["10"]}
-
-$ prog
-{"NAME_-2": []}

+ 0 - 957
vendor/github.com/docopt/docopt-go/testcases.docopt

@@ -1,957 +0,0 @@
-r"""Usage: prog
-
-"""
-$ prog
-{}
-
-$ prog --xxx
-"user-error"
-
-
-r"""Usage: prog [options]
-
-Options: -a  All.
-
-"""
-$ prog
-{"-a": false}
-
-$ prog -a
-{"-a": true}
-
-$ prog -x
-"user-error"
-
-
-r"""Usage: prog [options]
-
-Options: --all  All.
-
-"""
-$ prog
-{"--all": false}
-
-$ prog --all
-{"--all": true}
-
-$ prog --xxx
-"user-error"
-
-
-r"""Usage: prog [options]
-
-Options: -v, --verbose  Verbose.
-
-"""
-$ prog --verbose
-{"--verbose": true}
-
-$ prog --ver
-{"--verbose": true}
-
-$ prog -v
-{"--verbose": true}
-
-
-r"""Usage: prog [options]
-
-Options: -p PATH
-
-"""
-$ prog -p home/
-{"-p": "home/"}
-
-$ prog -phome/
-{"-p": "home/"}
-
-$ prog -p
-"user-error"
-
-
-r"""Usage: prog [options]
-
-Options: --path <path>
-
-"""
-$ prog --path home/
-{"--path": "home/"}
-
-$ prog --path=home/
-{"--path": "home/"}
-
-$ prog --pa home/
-{"--path": "home/"}
-
-$ prog --pa=home/
-{"--path": "home/"}
-
-$ prog --path
-"user-error"
-
-
-r"""Usage: prog [options]
-
-Options: -p PATH, --path=<path>  Path to files.
-
-"""
-$ prog -proot
-{"--path": "root"}
-
-
-r"""Usage: prog [options]
-
-Options:    -p --path PATH  Path to files.
-
-"""
-$ prog -p root
-{"--path": "root"}
-
-$ prog --path root
-{"--path": "root"}
-
-
-r"""Usage: prog [options]
-
-Options:
- -p PATH  Path to files [default: ./]
-
-"""
-$ prog
-{"-p": "./"}
-
-$ prog -phome
-{"-p": "home"}
-
-
-r"""UsAgE: prog [options]
-
-OpTiOnS: --path=<files>  Path to files
-                [dEfAuLt: /root]
-
-"""
-$ prog
-{"--path": "/root"}
-
-$ prog --path=home
-{"--path": "home"}
-
-
-r"""usage: prog [options]
-
-options:
-    -a        Add
-    -r        Remote
-    -m <msg>  Message
-
-"""
-$ prog -a -r -m Hello
-{"-a": true,
- "-r": true,
- "-m": "Hello"}
-
-$ prog -armyourass
-{"-a": true,
- "-r": true,
- "-m": "yourass"}
-
-$ prog -a -r
-{"-a": true,
- "-r": true,
- "-m": null}
-
-
-r"""Usage: prog [options]
-
-Options: --version
-         --verbose
-
-"""
-$ prog --version
-{"--version": true,
- "--verbose": false}
-
-$ prog --verbose
-{"--version": false,
- "--verbose": true}
-
-$ prog --ver
-"user-error"
-
-$ prog --verb
-{"--version": false,
- "--verbose": true}
-
-
-r"""usage: prog [-a -r -m <msg>]
-
-options:
- -a        Add
- -r        Remote
- -m <msg>  Message
-
-"""
-$ prog -armyourass
-{"-a": true,
- "-r": true,
- "-m": "yourass"}
-
-
-r"""usage: prog [-armmsg]
-
-options: -a        Add
-         -r        Remote
-         -m <msg>  Message
-
-"""
-$ prog -a -r -m Hello
-{"-a": true,
- "-r": true,
- "-m": "Hello"}
-
-
-r"""usage: prog -a -b
-
-options:
- -a
- -b
-
-"""
-$ prog -a -b
-{"-a": true, "-b": true}
-
-$ prog -b -a
-{"-a": true, "-b": true}
-
-$ prog -a
-"user-error"
-
-$ prog
-"user-error"
-
-
-r"""usage: prog (-a -b)
-
-options: -a
-         -b
-
-"""
-$ prog -a -b
-{"-a": true, "-b": true}
-
-$ prog -b -a
-{"-a": true, "-b": true}
-
-$ prog -a
-"user-error"
-
-$ prog
-"user-error"
-
-
-r"""usage: prog [-a] -b
-
-options: -a
- -b
-
-"""
-$ prog -a -b
-{"-a": true, "-b": true}
-
-$ prog -b -a
-{"-a": true, "-b": true}
-
-$ prog -a
-"user-error"
-
-$ prog -b
-{"-a": false, "-b": true}
-
-$ prog
-"user-error"
-
-
-r"""usage: prog [(-a -b)]
-
-options: -a
-         -b
-
-"""
-$ prog -a -b
-{"-a": true, "-b": true}
-
-$ prog -b -a
-{"-a": true, "-b": true}
-
-$ prog -a
-"user-error"
-
-$ prog -b
-"user-error"
-
-$ prog
-{"-a": false, "-b": false}
-
-
-r"""usage: prog (-a|-b)
-
-options: -a
-         -b
-
-"""
-$ prog -a -b
-"user-error"
-
-$ prog
-"user-error"
-
-$ prog -a
-{"-a": true, "-b": false}
-
-$ prog -b
-{"-a": false, "-b": true}
-
-
-r"""usage: prog [ -a | -b ]
-
-options: -a
-         -b
-
-"""
-$ prog -a -b
-"user-error"
-
-$ prog
-{"-a": false, "-b": false}
-
-$ prog -a
-{"-a": true, "-b": false}
-
-$ prog -b
-{"-a": false, "-b": true}
-
-
-r"""usage: prog <arg>"""
-$ prog 10
-{"<arg>": "10"}
-
-$ prog 10 20
-"user-error"
-
-$ prog
-"user-error"
-
-
-r"""usage: prog [<arg>]"""
-$ prog 10
-{"<arg>": "10"}
-
-$ prog 10 20
-"user-error"
-
-$ prog
-{"<arg>": null}
-
-
-r"""usage: prog <kind> <name> <type>"""
-$ prog 10 20 40
-{"<kind>": "10", "<name>": "20", "<type>": "40"}
-
-$ prog 10 20
-"user-error"
-
-$ prog
-"user-error"
-
-
-r"""usage: prog <kind> [<name> <type>]"""
-$ prog 10 20 40
-{"<kind>": "10", "<name>": "20", "<type>": "40"}
-
-$ prog 10 20
-{"<kind>": "10", "<name>": "20", "<type>": null}
-
-$ prog
-"user-error"
-
-
-r"""usage: prog [<kind> | <name> <type>]"""
-$ prog 10 20 40
-"user-error"
-
-$ prog 20 40
-{"<kind>": null, "<name>": "20", "<type>": "40"}
-
-$ prog
-{"<kind>": null, "<name>": null, "<type>": null}
-
-
-r"""usage: prog (<kind> --all | <name>)
-
-options:
- --all
-
-"""
-$ prog 10 --all
-{"<kind>": "10", "--all": true, "<name>": null}
-
-$ prog 10
-{"<kind>": null, "--all": false, "<name>": "10"}
-
-$ prog
-"user-error"
-
-
-r"""usage: prog [<name> <name>]"""
-$ prog 10 20
-{"<name>": ["10", "20"]}
-
-$ prog 10
-{"<name>": ["10"]}
-
-$ prog
-{"<name>": []}
-
-
-r"""usage: prog [(<name> <name>)]"""
-$ prog 10 20
-{"<name>": ["10", "20"]}
-
-$ prog 10
-"user-error"
-
-$ prog
-{"<name>": []}
-
-
-r"""usage: prog NAME..."""
-$ prog 10 20
-{"NAME": ["10", "20"]}
-
-$ prog 10
-{"NAME": ["10"]}
-
-$ prog
-"user-error"
-
-
-r"""usage: prog [NAME]..."""
-$ prog 10 20
-{"NAME": ["10", "20"]}
-
-$ prog 10
-{"NAME": ["10"]}
-
-$ prog
-{"NAME": []}
-
-
-r"""usage: prog [NAME...]"""
-$ prog 10 20
-{"NAME": ["10", "20"]}
-
-$ prog 10
-{"NAME": ["10"]}
-
-$ prog
-{"NAME": []}
-
-
-r"""usage: prog [NAME [NAME ...]]"""
-$ prog 10 20
-{"NAME": ["10", "20"]}
-
-$ prog 10
-{"NAME": ["10"]}
-
-$ prog
-{"NAME": []}
-
-
-r"""usage: prog (NAME | --foo NAME)
-
-options: --foo
-
-"""
-$ prog 10
-{"NAME": "10", "--foo": false}
-
-$ prog --foo 10
-{"NAME": "10", "--foo": true}
-
-$ prog --foo=10
-"user-error"
-
-
-r"""usage: prog (NAME | --foo) [--bar | NAME]
-
-options: --foo
-options: --bar
-
-"""
-$ prog 10
-{"NAME": ["10"], "--foo": false, "--bar": false}
-
-$ prog 10 20
-{"NAME": ["10", "20"], "--foo": false, "--bar": false}
-
-$ prog --foo --bar
-{"NAME": [], "--foo": true, "--bar": true}
-
-
-r"""Naval Fate.
-
-Usage:
-  prog ship new <name>...
-  prog ship [<name>] move <x> <y> [--speed=<kn>]
-  prog ship shoot <x> <y>
-  prog mine (set|remove) <x> <y> [--moored|--drifting]
-  prog -h | --help
-  prog --version
-
-Options:
-  -h --help     Show this screen.
-  --version     Show version.
-  --speed=<kn>  Speed in knots [default: 10].
-  --moored      Mored (anchored) mine.
-  --drifting    Drifting mine.
-
-"""
-$ prog ship Guardian move 150 300 --speed=20
-{"--drifting": false,
- "--help": false,
- "--moored": false,
- "--speed": "20",
- "--version": false,
- "<name>": ["Guardian"],
- "<x>": "150",
- "<y>": "300",
- "mine": false,
- "move": true,
- "new": false,
- "remove": false,
- "set": false,
- "ship": true,
- "shoot": false}
-
-
-r"""usage: prog --hello"""
-$ prog --hello
-{"--hello": true}
-
-
-r"""usage: prog [--hello=<world>]"""
-$ prog
-{"--hello": null}
-
-$ prog --hello wrld
-{"--hello": "wrld"}
-
-
-r"""usage: prog [-o]"""
-$ prog
-{"-o": false}
-
-$ prog -o
-{"-o": true}
-
-
-r"""usage: prog [-opr]"""
-$ prog -op
-{"-o": true, "-p": true, "-r": false}
-
-
-r"""usage: prog --aabb | --aa"""
-$ prog --aa
-{"--aabb": false, "--aa": true}
-
-$ prog --a
-"user-error"  # not a unique prefix
-
-#
-# Counting number of flags
-#
-
-r"""Usage: prog -v"""
-$ prog -v
-{"-v": true}
-
-
-r"""Usage: prog [-v -v]"""
-$ prog
-{"-v": 0}
-
-$ prog -v
-{"-v": 1}
-
-$ prog -vv
-{"-v": 2}
-
-
-r"""Usage: prog -v ..."""
-$ prog
-"user-error"
-
-$ prog -v
-{"-v": 1}
-
-$ prog -vv
-{"-v": 2}
-
-$ prog -vvvvvv
-{"-v": 6}
-
-
-r"""Usage: prog [-v | -vv | -vvv]
-
-This one is probably most readable user-friednly variant.
-
-"""
-$ prog
-{"-v": 0}
-
-$ prog -v
-{"-v": 1}
-
-$ prog -vv
-{"-v": 2}
-
-$ prog -vvvv
-"user-error"
-
-
-r"""usage: prog [--ver --ver]"""
-$ prog --ver --ver
-{"--ver": 2}
-
-
-#
-# Counting commands
-#
-
-r"""usage: prog [go]"""
-$ prog go
-{"go": true}
-
-
-r"""usage: prog [go go]"""
-$ prog
-{"go": 0}
-
-$ prog go
-{"go": 1}
-
-$ prog go go
-{"go": 2}
-
-$ prog go go go
-"user-error"
-
-r"""usage: prog go..."""
-$ prog go go go go go
-{"go": 5}
-
-#
-# [options] does not include options from usage-pattern
-#
-r"""usage: prog [options] [-a]
-
-options: -a
-         -b
-"""
-$ prog -a
-{"-a": true, "-b": false}
-
-$ prog -aa
-"user-error"
-
-#
-# Test [options] shourtcut
-#
-
-r"""Usage: prog [options] A
-Options:
-    -q  Be quiet
-    -v  Be verbose.
-
-"""
-$ prog arg
-{"A": "arg", "-v": false, "-q": false}
-
-$ prog -v arg
-{"A": "arg", "-v": true, "-q": false}
-
-$ prog -q arg
-{"A": "arg", "-v": false, "-q": true}
-
-#
-# Test single dash
-#
-
-r"""usage: prog [-]"""
-
-$ prog -
-{"-": true}
-
-$ prog
-{"-": false}
-
-#
-# If argument is repeated, its value should always be a list
-#
-
-r"""usage: prog [NAME [NAME ...]]"""
-
-$ prog a b
-{"NAME": ["a", "b"]}
-
-$ prog
-{"NAME": []}
-
-#
-# Option's argument defaults to null/None
-#
-
-r"""usage: prog [options]
-options:
- -a        Add
- -m <msg>  Message
-
-"""
-$ prog -a
-{"-m": null, "-a": true}
-
-#
-# Test options without description
-#
-
-r"""usage: prog --hello"""
-$ prog --hello
-{"--hello": true}
-
-r"""usage: prog [--hello=<world>]"""
-$ prog
-{"--hello": null}
-
-$ prog --hello wrld
-{"--hello": "wrld"}
-
-r"""usage: prog [-o]"""
-$ prog
-{"-o": false}
-
-$ prog -o
-{"-o": true}
-
-r"""usage: prog [-opr]"""
-$ prog -op
-{"-o": true, "-p": true, "-r": false}
-
-r"""usage: git [-v | --verbose]"""
-$ prog -v
-{"-v": true, "--verbose": false}
-
-r"""usage: git remote [-v | --verbose]"""
-$ prog remote -v
-{"remote": true, "-v": true, "--verbose": false}
-
-#
-# Test empty usage pattern
-#
-
-r"""usage: prog"""
-$ prog
-{}
-
-r"""usage: prog
-           prog <a> <b>
-"""
-$ prog 1 2
-{"<a>": "1", "<b>": "2"}
-
-$ prog
-{"<a>": null, "<b>": null}
-
-r"""usage: prog <a> <b>
-           prog
-"""
-$ prog
-{"<a>": null, "<b>": null}
-
-#
-# Option's argument should not capture default value from usage pattern
-#
-
-r"""usage: prog [--file=<f>]"""
-$ prog
-{"--file": null}
-
-r"""usage: prog [--file=<f>]
-
-options: --file <a>
-
-"""
-$ prog
-{"--file": null}
-
-r"""Usage: prog [-a <host:port>]
-
-Options: -a, --address <host:port>  TCP address [default: localhost:6283].
-
-"""
-$ prog
-{"--address": "localhost:6283"}
-
-#
-# If option with argument could be repeated,
-# its arguments should be accumulated into a list
-#
-
-r"""usage: prog --long=<arg> ..."""
-
-$ prog --long one
-{"--long": ["one"]}
-
-$ prog --long one --long two
-{"--long": ["one", "two"]}
-
-#
-# Test multiple elements repeated at once
-#
-
-r"""usage: prog (go <direction> --speed=<km/h>)..."""
-$ prog  go left --speed=5  go right --speed=9
-{"go": 2, "<direction>": ["left", "right"], "--speed": ["5", "9"]}
-
-#
-# Required options should work with option shortcut
-#
-
-r"""usage: prog [options] -a
-
-options: -a
-
-"""
-$ prog -a
-{"-a": true}
-
-#
-# If option could be repeated its defaults should be split into a list
-#
-
-r"""usage: prog [-o <o>]...
-
-options: -o <o>  [default: x]
-
-"""
-$ prog -o this -o that
-{"-o": ["this", "that"]}
-
-$ prog
-{"-o": ["x"]}
-
-r"""usage: prog [-o <o>]...
-
-options: -o <o>  [default: x y]
-
-"""
-$ prog -o this
-{"-o": ["this"]}
-
-$ prog
-{"-o": ["x", "y"]}
-
-#
-# Test stacked option's argument
-#
-
-r"""usage: prog -pPATH
-
-options: -p PATH
-
-"""
-$ prog -pHOME
-{"-p": "HOME"}
-
-#
-# Issue 56: Repeated mutually exclusive args give nested lists sometimes
-#
-
-r"""Usage: foo (--xx=x|--yy=y)..."""
-$ prog --xx=1 --yy=2
-{"--xx": ["1"], "--yy": ["2"]}
-
-#
-# POSIXly correct tokenization
-#
-
-r"""usage: prog [<input file>]"""
-$ prog f.txt
-{"<input file>": "f.txt"}
-
-r"""usage: prog [--input=<file name>]..."""
-$ prog --input a.txt --input=b.txt
-{"--input": ["a.txt", "b.txt"]}
-
-#
-# Issue 85: `[options]` shourtcut with multiple subcommands
-#
-
-r"""usage: prog good [options]
-           prog fail [options]
-
-options: --loglevel=N
-
-"""
-$ prog fail --loglevel 5
-{"--loglevel": "5", "fail": true, "good": false}
-
-#
-# Usage-section syntax
-#
-
-r"""usage:prog --foo"""
-$ prog --foo
-{"--foo": true}
-
-r"""PROGRAM USAGE: prog --foo"""
-$ prog --foo
-{"--foo": true}
-
-r"""Usage: prog --foo
-           prog --bar
-NOT PART OF SECTION"""
-$ prog --foo
-{"--foo": true, "--bar": false}
-
-r"""Usage:
- prog --foo
- prog --bar
-
-NOT PART OF SECTION"""
-$ prog --foo
-{"--foo": true, "--bar": false}
-
-r"""Usage:
- prog --foo
- prog --bar
-NOT PART OF SECTION"""
-$ prog --foo
-{"--foo": true, "--bar": false}
-
-#
-# Options-section syntax
-#
-
-r"""Usage: prog [options]
-
-global options: --foo
-local options: --baz
-               --bar
-other options:
- --egg
- --spam
--not-an-option-
-
-"""
-$ prog --baz --egg
-{"--foo": false, "--baz": true, "--bar": false, "--egg": true, "--spam": false}

+ 2 - 2
vendor/github.com/fatedier/beego/controller.go

@@ -223,7 +223,7 @@ func (c *Controller) RenderBytes() ([]byte, error) {
 		}
 
 		buf.Reset()
-		ExecuteViewPathTemplate(&buf, c.Layout, c.viewPath(), c.Data)
+		ExecuteViewPathTemplate(&buf, c.Layout, c.viewPath() ,c.Data)
 	}
 	return buf.Bytes(), err
 }
@@ -249,7 +249,7 @@ func (c *Controller) renderTemplate() (bytes.Buffer, error) {
 				}
 			}
 		}
-		BuildTemplate(c.viewPath(), buildFiles...)
+		BuildTemplate(c.viewPath() , buildFiles...)
 	}
 	return buf, ExecuteViewPathTemplate(&buf, c.TplName, c.viewPath(), c.Data)
 }

+ 2 - 2
vendor/github.com/fatedier/beego/controller_test.go

@@ -172,10 +172,10 @@ func TestAdditionalViewPaths(t *testing.T) {
 				t.Fatal("TestAdditionalViewPaths expected error")
 			}
 		}()
-		ctrl.RenderString()
+		ctrl.RenderString();
 	}()
 
 	ctrl.TplName = "file2.tpl"
 	ctrl.ViewPath = dir2
-	ctrl.RenderString()
+	ctrl.RenderString();
 }

+ 1 - 0
vendor/github.com/fatedier/beego/logs/alils/signature.go

@@ -109,3 +109,4 @@ func signature(project *LogProject, method, uri string,
 	digest = base64.StdEncoding.EncodeToString(mac.Sum(nil))
 	return
 }
+

+ 1 - 1
vendor/github.com/fatedier/beego/orm/db.go

@@ -48,7 +48,7 @@ var (
 		"lte":         true,
 		"eq":          true,
 		"nq":          true,
-		"ne":          true,
+		"ne":	       true,
 		"startswith":  true,
 		"endswith":    true,
 		"istartswith": true,

+ 8 - 8
vendor/github.com/fatedier/beego/template.go

@@ -31,11 +31,11 @@ import (
 )
 
 var (
-	beegoTplFuncMap           = make(template.FuncMap)
+	beegoTplFuncMap = make(template.FuncMap)
 	beeViewPathTemplateLocked = false
 	// beeViewPathTemplates caching map and supported template file extensions per view
-	beeViewPathTemplates = make(map[string]map[string]*template.Template)
-	templatesLock        sync.RWMutex
+	beeViewPathTemplates  = make(map[string]map[string]*template.Template)
+	templatesLock sync.RWMutex
 	// beeTemplateExt stores the template extension which will build
 	beeTemplateExt = []string{"tpl", "html"}
 	// beeTemplatePreprocessors stores associations of extension -> preprocessor handler
@@ -46,7 +46,7 @@ var (
 // writing the output to wr.
 // A template will be executed safely in parallel.
 func ExecuteTemplate(wr io.Writer, name string, data interface{}) error {
-	return ExecuteViewPathTemplate(wr, name, BConfig.WebConfig.ViewsPath, data)
+	return ExecuteViewPathTemplate(wr,name, BConfig.WebConfig.ViewsPath, data)
 }
 
 // ExecuteViewPathTemplate applies the template with name and from specific viewPath to the specified data object,
@@ -57,7 +57,7 @@ func ExecuteViewPathTemplate(wr io.Writer, name string, viewPath string, data in
 		templatesLock.RLock()
 		defer templatesLock.RUnlock()
 	}
-	if beeTemplates, ok := beeViewPathTemplates[viewPath]; ok {
+	if beeTemplates,ok := beeViewPathTemplates[viewPath]; ok {
 		if t, ok := beeTemplates[name]; ok {
 			var err error
 			if t.Lookup(name) != nil {
@@ -160,9 +160,9 @@ func AddTemplateExt(ext string) {
 	beeTemplateExt = append(beeTemplateExt, ext)
 }
 
-// AddViewPath adds a new path to the supported view paths.
+// AddViewPath adds a new path to the supported view paths. 
 //Can later be used by setting a controller ViewPath to this folder
-//will panic if called after beego.Run()
+//will panic if called after beego.Run() 
 func AddViewPath(viewPath string) error {
 	if beeViewPathTemplateLocked {
 		panic("Can not add new view paths after beego.Run()")
@@ -184,7 +184,7 @@ func BuildTemplate(dir string, files ...string) error {
 		}
 		return errors.New("dir open err")
 	}
-	beeTemplates, ok := beeViewPathTemplates[dir]
+	beeTemplates,ok := beeViewPathTemplates[dir];
 	if !ok {
 		panic("Unknown view path: " + dir)
 	}

+ 1 - 1
vendor/github.com/fatedier/beego/toolbox/statistics.go

@@ -119,7 +119,7 @@ func (m *URLMap) GetMap() map[string]interface{} {
 func (m *URLMap) GetMapData() []map[string]interface{} {
 	m.lock.Lock()
 	defer m.lock.Unlock()
-
+	
 	var resultLists []map[string]interface{}
 
 	for k, v := range m.urlmap {

+ 132 - 132
vendor/github.com/klauspost/cpuid/private/cpuid.go

@@ -12,146 +12,146 @@ import (
 type vendor int
 
 const (
-	other vendor = iota
+	other	vendor	= iota
 	intel
 	amd
 	via
 	transmeta
 	nsc
-	kvm  // Kernel-based Virtual Machine
-	msvm // Microsoft Hyper-V or Windows Virtual PC
+	kvm	// Kernel-based Virtual Machine
+	msvm	// Microsoft Hyper-V or Windows Virtual PC
 	vmware
 	xenhvm
 )
 
 const (
-	cmov        = 1 << iota // i686 CMOV
-	nx                      // NX (No-Execute) bit
-	amd3dnow                // AMD 3DNOW
-	amd3dnowext             // AMD 3DNowExt
-	mmx                     // standard MMX
-	mmxext                  // SSE integer functions or AMD MMX ext
-	sse                     // SSE functions
-	sse2                    // P4 SSE functions
-	sse3                    // Prescott SSE3 functions
-	ssse3                   // Conroe SSSE3 functions
-	sse4                    // Penryn SSE4.1 functions
-	sse4a                   // AMD Barcelona microarchitecture SSE4a instructions
-	sse42                   // Nehalem SSE4.2 functions
-	avx                     // AVX functions
-	avx2                    // AVX2 functions
-	fma3                    // Intel FMA 3
-	fma4                    // Bulldozer FMA4 functions
-	xop                     // Bulldozer XOP functions
-	f16c                    // Half-precision floating-point conversion
-	bmi1                    // Bit Manipulation Instruction Set 1
-	bmi2                    // Bit Manipulation Instruction Set 2
-	tbm                     // AMD Trailing Bit Manipulation
-	lzcnt                   // LZCNT instruction
-	popcnt                  // POPCNT instruction
-	aesni                   // Advanced Encryption Standard New Instructions
-	clmul                   // Carry-less Multiplication
-	htt                     // Hyperthreading (enabled)
-	hle                     // Hardware Lock Elision
-	rtm                     // Restricted Transactional Memory
-	rdrand                  // RDRAND instruction is available
-	rdseed                  // RDSEED instruction is available
-	adx                     // Intel ADX (Multi-Precision Add-Carry Instruction Extensions)
-	sha                     // Intel SHA Extensions
-	avx512f                 // AVX-512 Foundation
-	avx512dq                // AVX-512 Doubleword and Quadword Instructions
-	avx512ifma              // AVX-512 Integer Fused Multiply-Add Instructions
-	avx512pf                // AVX-512 Prefetch Instructions
-	avx512er                // AVX-512 Exponential and Reciprocal Instructions
-	avx512cd                // AVX-512 Conflict Detection Instructions
-	avx512bw                // AVX-512 Byte and Word Instructions
-	avx512vl                // AVX-512 Vector Length Extensions
-	avx512vbmi              // AVX-512 Vector Bit Manipulation Instructions
-	mpx                     // Intel MPX (Memory Protection Extensions)
-	erms                    // Enhanced REP MOVSB/STOSB
-	rdtscp                  // RDTSCP Instruction
-	cx16                    // CMPXCHG16B Instruction
+	cmov		= 1 << iota	// i686 CMOV
+	nx				// NX (No-Execute) bit
+	amd3dnow			// AMD 3DNOW
+	amd3dnowext			// AMD 3DNowExt
+	mmx				// standard MMX
+	mmxext				// SSE integer functions or AMD MMX ext
+	sse				// SSE functions
+	sse2				// P4 SSE functions
+	sse3				// Prescott SSE3 functions
+	ssse3				// Conroe SSSE3 functions
+	sse4				// Penryn SSE4.1 functions
+	sse4a				// AMD Barcelona microarchitecture SSE4a instructions
+	sse42				// Nehalem SSE4.2 functions
+	avx				// AVX functions
+	avx2				// AVX2 functions
+	fma3				// Intel FMA 3
+	fma4				// Bulldozer FMA4 functions
+	xop				// Bulldozer XOP functions
+	f16c				// Half-precision floating-point conversion
+	bmi1				// Bit Manipulation Instruction Set 1
+	bmi2				// Bit Manipulation Instruction Set 2
+	tbm				// AMD Trailing Bit Manipulation
+	lzcnt				// LZCNT instruction
+	popcnt				// POPCNT instruction
+	aesni				// Advanced Encryption Standard New Instructions
+	clmul				// Carry-less Multiplication
+	htt				// Hyperthreading (enabled)
+	hle				// Hardware Lock Elision
+	rtm				// Restricted Transactional Memory
+	rdrand				// RDRAND instruction is available
+	rdseed				// RDSEED instruction is available
+	adx				// Intel ADX (Multi-Precision Add-Carry Instruction Extensions)
+	sha				// Intel SHA Extensions
+	avx512f				// AVX-512 Foundation
+	avx512dq			// AVX-512 Doubleword and Quadword Instructions
+	avx512ifma			// AVX-512 Integer Fused Multiply-Add Instructions
+	avx512pf			// AVX-512 Prefetch Instructions
+	avx512er			// AVX-512 Exponential and Reciprocal Instructions
+	avx512cd			// AVX-512 Conflict Detection Instructions
+	avx512bw			// AVX-512 Byte and Word Instructions
+	avx512vl			// AVX-512 Vector Length Extensions
+	avx512vbmi			// AVX-512 Vector Bit Manipulation Instructions
+	mpx				// Intel MPX (Memory Protection Extensions)
+	erms				// Enhanced REP MOVSB/STOSB
+	rdtscp				// RDTSCP Instruction
+	cx16				// CMPXCHG16B Instruction
 
 	// Performance indicators
-	sse2slow // SSE2 is supported, but usually not faster
-	sse3slow // SSE3 is supported, but usually not faster
-	atom     // Atom processor, some SSSE3 instructions are slower
+	sse2slow	// SSE2 is supported, but usually not faster
+	sse3slow	// SSE3 is supported, but usually not faster
+	atom		// Atom processor, some SSSE3 instructions are slower
 )
 
 var flagNames = map[flags]string{
-	cmov:        "CMOV",        // i686 CMOV
-	nx:          "NX",          // NX (No-Execute) bit
-	amd3dnow:    "AMD3DNOW",    // AMD 3DNOW
-	amd3dnowext: "AMD3DNOWEXT", // AMD 3DNowExt
-	mmx:         "MMX",         // Standard MMX
-	mmxext:      "MMXEXT",      // SSE integer functions or AMD MMX ext
-	sse:         "SSE",         // SSE functions
-	sse2:        "SSE2",        // P4 SSE2 functions
-	sse3:        "SSE3",        // Prescott SSE3 functions
-	ssse3:       "SSSE3",       // Conroe SSSE3 functions
-	sse4:        "SSE4.1",      // Penryn SSE4.1 functions
-	sse4a:       "SSE4A",       // AMD Barcelona microarchitecture SSE4a instructions
-	sse42:       "SSE4.2",      // Nehalem SSE4.2 functions
-	avx:         "AVX",         // AVX functions
-	avx2:        "AVX2",        // AVX functions
-	fma3:        "FMA3",        // Intel FMA 3
-	fma4:        "FMA4",        // Bulldozer FMA4 functions
-	xop:         "XOP",         // Bulldozer XOP functions
-	f16c:        "F16C",        // Half-precision floating-point conversion
-	bmi1:        "BMI1",        // Bit Manipulation Instruction Set 1
-	bmi2:        "BMI2",        // Bit Manipulation Instruction Set 2
-	tbm:         "TBM",         // AMD Trailing Bit Manipulation
-	lzcnt:       "LZCNT",       // LZCNT instruction
-	popcnt:      "POPCNT",      // POPCNT instruction
-	aesni:       "AESNI",       // Advanced Encryption Standard New Instructions
-	clmul:       "CLMUL",       // Carry-less Multiplication
-	htt:         "HTT",         // Hyperthreading (enabled)
-	hle:         "HLE",         // Hardware Lock Elision
-	rtm:         "RTM",         // Restricted Transactional Memory
-	rdrand:      "RDRAND",      // RDRAND instruction is available
-	rdseed:      "RDSEED",      // RDSEED instruction is available
-	adx:         "ADX",         // Intel ADX (Multi-Precision Add-Carry Instruction Extensions)
-	sha:         "SHA",         // Intel SHA Extensions
-	avx512f:     "AVX512F",     // AVX-512 Foundation
-	avx512dq:    "AVX512DQ",    // AVX-512 Doubleword and Quadword Instructions
-	avx512ifma:  "AVX512IFMA",  // AVX-512 Integer Fused Multiply-Add Instructions
-	avx512pf:    "AVX512PF",    // AVX-512 Prefetch Instructions
-	avx512er:    "AVX512ER",    // AVX-512 Exponential and Reciprocal Instructions
-	avx512cd:    "AVX512CD",    // AVX-512 Conflict Detection Instructions
-	avx512bw:    "AVX512BW",    // AVX-512 Byte and Word Instructions
-	avx512vl:    "AVX512VL",    // AVX-512 Vector Length Extensions
-	avx512vbmi:  "AVX512VBMI",  // AVX-512 Vector Bit Manipulation Instructions
-	mpx:         "MPX",         // Intel MPX (Memory Protection Extensions)
-	erms:        "ERMS",        // Enhanced REP MOVSB/STOSB
-	rdtscp:      "RDTSCP",      // RDTSCP Instruction
-	cx16:        "CX16",        // CMPXCHG16B Instruction
+	cmov:		"CMOV",		// i686 CMOV
+	nx:		"NX",		// NX (No-Execute) bit
+	amd3dnow:	"AMD3DNOW",	// AMD 3DNOW
+	amd3dnowext:	"AMD3DNOWEXT",	// AMD 3DNowExt
+	mmx:		"MMX",		// Standard MMX
+	mmxext:		"MMXEXT",	// SSE integer functions or AMD MMX ext
+	sse:		"SSE",		// SSE functions
+	sse2:		"SSE2",		// P4 SSE2 functions
+	sse3:		"SSE3",		// Prescott SSE3 functions
+	ssse3:		"SSSE3",	// Conroe SSSE3 functions
+	sse4:		"SSE4.1",	// Penryn SSE4.1 functions
+	sse4a:		"SSE4A",	// AMD Barcelona microarchitecture SSE4a instructions
+	sse42:		"SSE4.2",	// Nehalem SSE4.2 functions
+	avx:		"AVX",		// AVX functions
+	avx2:		"AVX2",		// AVX functions
+	fma3:		"FMA3",		// Intel FMA 3
+	fma4:		"FMA4",		// Bulldozer FMA4 functions
+	xop:		"XOP",		// Bulldozer XOP functions
+	f16c:		"F16C",		// Half-precision floating-point conversion
+	bmi1:		"BMI1",		// Bit Manipulation Instruction Set 1
+	bmi2:		"BMI2",		// Bit Manipulation Instruction Set 2
+	tbm:		"TBM",		// AMD Trailing Bit Manipulation
+	lzcnt:		"LZCNT",	// LZCNT instruction
+	popcnt:		"POPCNT",	// POPCNT instruction
+	aesni:		"AESNI",	// Advanced Encryption Standard New Instructions
+	clmul:		"CLMUL",	// Carry-less Multiplication
+	htt:		"HTT",		// Hyperthreading (enabled)
+	hle:		"HLE",		// Hardware Lock Elision
+	rtm:		"RTM",		// Restricted Transactional Memory
+	rdrand:		"RDRAND",	// RDRAND instruction is available
+	rdseed:		"RDSEED",	// RDSEED instruction is available
+	adx:		"ADX",		// Intel ADX (Multi-Precision Add-Carry Instruction Extensions)
+	sha:		"SHA",		// Intel SHA Extensions
+	avx512f:	"AVX512F",	// AVX-512 Foundation
+	avx512dq:	"AVX512DQ",	// AVX-512 Doubleword and Quadword Instructions
+	avx512ifma:	"AVX512IFMA",	// AVX-512 Integer Fused Multiply-Add Instructions
+	avx512pf:	"AVX512PF",	// AVX-512 Prefetch Instructions
+	avx512er:	"AVX512ER",	// AVX-512 Exponential and Reciprocal Instructions
+	avx512cd:	"AVX512CD",	// AVX-512 Conflict Detection Instructions
+	avx512bw:	"AVX512BW",	// AVX-512 Byte and Word Instructions
+	avx512vl:	"AVX512VL",	// AVX-512 Vector Length Extensions
+	avx512vbmi:	"AVX512VBMI",	// AVX-512 Vector Bit Manipulation Instructions
+	mpx:		"MPX",		// Intel MPX (Memory Protection Extensions)
+	erms:		"ERMS",		// Enhanced REP MOVSB/STOSB
+	rdtscp:		"RDTSCP",	// RDTSCP Instruction
+	cx16:		"CX16",		// CMPXCHG16B Instruction
 
 	// Performance indicators
-	sse2slow: "SSE2SLOW", // SSE2 supported, but usually not faster
-	sse3slow: "SSE3SLOW", // SSE3 supported, but usually not faster
-	atom:     "ATOM",     // Atom processor, some SSSE3 instructions are slower
+	sse2slow:	"SSE2SLOW",	// SSE2 supported, but usually not faster
+	sse3slow:	"SSE3SLOW",	// SSE3 supported, but usually not faster
+	atom:		"ATOM",		// Atom processor, some SSSE3 instructions are slower
 
 }
 
 // CPUInfo contains information about the detected system CPU.
 type cpuInfo struct {
-	brandname      string // Brand name reported by the CPU
-	vendorid       vendor // Comparable CPU vendor ID
-	features       flags  // Features of the CPU
-	physicalcores  int    // Number of physical processor cores in your CPU. Will be 0 if undetectable.
-	threadspercore int    // Number of threads per physical core. Will be 1 if undetectable.
-	logicalcores   int    // Number of physical cores times threads that can run on each core through the use of hyperthreading. Will be 0 if undetectable.
-	family         int    // CPU family number
-	model          int    // CPU model number
-	cacheline      int    // Cache line size in bytes. Will be 0 if undetectable.
-	cache          struct {
-		l1i int // L1 Instruction Cache (per core or shared). Will be -1 if undetected
-		l1d int // L1 Data Cache (per core or shared). Will be -1 if undetected
-		l2  int // L2 Cache (per core or shared). Will be -1 if undetected
-		l3  int // L3 Instruction Cache (per core or shared). Will be -1 if undetected
-	}
-	maxFunc   uint32
-	maxExFunc uint32
+	brandname	string	// Brand name reported by the CPU
+	vendorid	vendor	// Comparable CPU vendor ID
+	features	flags	// Features of the CPU
+	physicalcores	int	// Number of physical processor cores in your CPU. Will be 0 if undetectable.
+	threadspercore	int	// Number of threads per physical core. Will be 1 if undetectable.
+	logicalcores	int	// Number of physical cores times threads that can run on each core through the use of hyperthreading. Will be 0 if undetectable.
+	family		int	// CPU family number
+	model		int	// CPU model number
+	cacheline	int	// Cache line size in bytes. Will be 0 if undetectable.
+	cache		struct {
+		l1i	int	// L1 Instruction Cache (per core or shared). Will be -1 if undetected
+		l1d	int	// L1 Data Cache (per core or shared). Will be -1 if undetected
+		l2	int	// L2 Cache (per core or shared). Will be -1 if undetected
+		l3	int	// L3 Instruction Cache (per core or shared). Will be -1 if undetected
+	}
+	maxFunc		uint32
+	maxExFunc	uint32
 }
 
 var cpuid func(op uint32) (eax, ebx, ecx, edx uint32)
@@ -638,18 +638,18 @@ func physicalCores() int {
 
 // Except from http://en.wikipedia.org/wiki/CPUID#EAX.3D0:_Get_vendor_ID
 var vendorMapping = map[string]vendor{
-	"AMDisbetter!": amd,
-	"AuthenticAMD": amd,
-	"CentaurHauls": via,
-	"GenuineIntel": intel,
-	"TransmetaCPU": transmeta,
-	"GenuineTMx86": transmeta,
-	"Geode by NSC": nsc,
-	"VIA VIA VIA ": via,
-	"KVMKVMKVMKVM": kvm,
-	"Microsoft Hv": msvm,
-	"VMwareVMware": vmware,
-	"XenVMMXenVMM": xenhvm,
+	"AMDisbetter!":	amd,
+	"AuthenticAMD":	amd,
+	"CentaurHauls":	via,
+	"GenuineIntel":	intel,
+	"TransmetaCPU":	transmeta,
+	"GenuineTMx86":	transmeta,
+	"Geode by NSC":	nsc,
+	"VIA VIA VIA ":	via,
+	"KVMKVMKVMKVM":	kvm,
+	"Microsoft Hv":	msvm,
+	"VMwareVMware":	vmware,
+	"XenVMMXenVMM":	xenhvm,
 }
 
 func vendorID() vendor {
@@ -668,10 +668,10 @@ func cacheLine() int {
 	}
 
 	_, ebx, _, _ := cpuid(1)
-	cache := (ebx & 0xff00) >> 5 // cflush size
+	cache := (ebx & 0xff00) >> 5	// cflush size
 	if cache == 0 && maxExtendedFunction() >= 0x80000006 {
 		_, _, ecx, _ := cpuid(0x80000006)
-		cache = ecx & 0xff // cacheline size
+		cache = ecx & 0xff	// cacheline size
 	}
 	// TODO: Read from Cache and TLB Information
 	return int(cache)

+ 2 - 2
vendor/github.com/stretchr/testify/assert/assertions.go

@@ -181,7 +181,7 @@ func indentMessageLines(message string, longestLabelLen int) string {
 		// no need to align first line because it starts at the correct location (after the label)
 		if i != 0 {
 			// append alignLen+1 spaces to align with "{{longestLabel}}:" before adding tab
-			outBuf.WriteString("\n\r\t" + strings.Repeat(" ", longestLabelLen+1) + "\t")
+			outBuf.WriteString("\n\r\t" + strings.Repeat(" ", longestLabelLen +1) + "\t")
 		}
 		outBuf.WriteString(scanner.Text())
 	}
@@ -229,7 +229,7 @@ func Fail(t TestingT, failureMessage string, msgAndArgs ...interface{}) bool {
 }
 
 type labeledContent struct {
-	label   string
+	label string
 	content string
 }
 

+ 2 - 2
vendor/github.com/stretchr/testify/assert/assertions_test.go

@@ -250,8 +250,8 @@ func TestEqualFormatting(t *testing.T) {
 		msgAndArgs []interface{}
 		want       string
 	}{
-		{equalWant: "want", equalGot: "got", want: "\tassertions.go:[0-9]+: \r                          \r\tError Trace:\t\n\t\t\r\tError:      \tNot equal: \n\t\t\r\t            \texpected: \"want\"\n\t\t\r\t            \treceived: \"got\"\n"},
-		{equalWant: "want", equalGot: "got", msgAndArgs: []interface{}{"hello, %v!", "world"}, want: "\tassertions.go:[0-9]+: \r                          \r\tError Trace:\t\n\t\t\r\tError:      \tNot equal: \n\t\t\r\t            \texpected: \"want\"\n\t\t\r\t            \treceived: \"got\"\n\t\t\r\tMessages:   \thello, world!\n"},
+		{equalWant:"want", equalGot: "got", want: "\tassertions.go:[0-9]+: \r                          \r\tError Trace:\t\n\t\t\r\tError:      \tNot equal: \n\t\t\r\t            \texpected: \"want\"\n\t\t\r\t            \treceived: \"got\"\n"},
+		{equalWant:"want", equalGot: "got", msgAndArgs: []interface{}{"hello, %v!", "world"}, want: "\tassertions.go:[0-9]+: \r                          \r\tError Trace:\t\n\t\t\r\tError:      \tNot equal: \n\t\t\r\t            \texpected: \"want\"\n\t\t\r\t            \treceived: \"got\"\n\t\t\r\tMessages:   \thello, world!\n"},
 	} {
 		mockT := &bufferT{}
 		Equal(mockT, currCase.equalWant, currCase.equalGot, currCase.msgAndArgs...)

+ 1 - 1
vendor/github.com/tjfoc/gmsm/sm4/sm4.go

@@ -149,7 +149,7 @@ func cryptBlock(subkeys []uint32, b []uint32, r []byte, dst, src []byte, decrypt
 	permuteInitialBlock(b, src)
 	for i := 0; i < 32; i++ {
 		if decrypt {
-			tm = b[0] ^ l1(p(b[1]^b[2]^b[3]^subkeys[31-i]))
+			tm = b[0] ^ l1(p(b[1]^b[2]^b[3]^subkeys[31 - i]))
 			//			tm = feistel1(b[0], b[1], b[2], b[3], subkeys[31-i])
 		} else {
 			tm = b[0] ^ l1(p(b[1]^b[2]^b[3]^subkeys[i]))

+ 4 - 4
vendor/golang.org/x/crypto/ssh/kex.go

@@ -383,8 +383,8 @@ func init() {
 	// 4253 and Oakley Group 2 in RFC 2409.
 	p, _ := new(big.Int).SetString("FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD129024E088A67CC74020BBEA63B139B22514A08798E3404DDEF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7EDEE386BFB5A899FA5AE9F24117C4B1FE649286651ECE65381FFFFFFFFFFFFFFFF", 16)
 	kexAlgoMap[kexAlgoDH1SHA1] = &dhGroup{
-		g:       new(big.Int).SetInt64(2),
-		p:       p,
+		g: new(big.Int).SetInt64(2),
+		p: p,
 		pMinus1: new(big.Int).Sub(p, bigOne),
 	}
 
@@ -393,8 +393,8 @@ func init() {
 	p, _ = new(big.Int).SetString("FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD129024E088A67CC74020BBEA63B139B22514A08798E3404DDEF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7EDEE386BFB5A899FA5AE9F24117C4B1FE649286651ECE45B3DC2007CB8A163BF0598DA48361C55D39A69163FA8FD24CF5F83655D23DCA3AD961C62F356208552BB9ED529077096966D670C354E4ABC9804F1746C08CA18217C32905E462E36CE3BE39E772C180E86039B2783A2EC07A28FB5C55DF06F4C52C9DE2BCBF6955817183995497CEA956AE515D2261898FA051015728E5A8AACAA68FFFFFFFFFFFFFFFF", 16)
 
 	kexAlgoMap[kexAlgoDH14SHA1] = &dhGroup{
-		g:       new(big.Int).SetInt64(2),
-		p:       p,
+		g: new(big.Int).SetInt64(2),
+		p: p,
 		pMinus1: new(big.Int).Sub(p, bigOne),
 	}