浏览代码

Remove bashbrew (now canonically at https://github.com/docker-library/bashbrew)

Tianon Gravi 5 年之前
父节点
当前提交
e9a3c6d607
共有 100 个文件被更改,包括 31 次插入12814 次删除
  1. 0 6
      .gitignore
  2. 18 17
      .travis.sh
  3. 8 5
      .travis.yml
  4. 2 28
      Dockerfile
  5. 2 2
      README.md
  6. 1 0
      bashbrew-version
  7. 0 37
      bashbrew/.bashbrew-arch-to-goenv.sh
  8. 0 6
      bashbrew/.dockerignore
  9. 0 85
      bashbrew/Dockerfile.release
  10. 0 88
      bashbrew/README.md
  11. 0 14
      bashbrew/bashbrew-entrypoint.sh
  12. 0 13
      bashbrew/bashbrew.sh
  13. 0 15
      bashbrew/go/go.mod
  14. 0 81
      bashbrew/go/go.sum
  15. 0 119
      bashbrew/go/src/bashbrew/cmd-build.go
  16. 0 116
      bashbrew/go/src/bashbrew/cmd-cat.go
  17. 0 145
      bashbrew/go/src/bashbrew/cmd-deps.go
  18. 0 60
      bashbrew/go/src/bashbrew/cmd-from.go
  19. 0 67
      bashbrew/go/src/bashbrew/cmd-list.go
  20. 0 69
      bashbrew/go/src/bashbrew/cmd-push.go
  21. 0 191
      bashbrew/go/src/bashbrew/cmd-put-shared.go
  22. 0 50
      bashbrew/go/src/bashbrew/cmd-tag.go
  23. 0 244
      bashbrew/go/src/bashbrew/config.go
  24. 0 299
      bashbrew/go/src/bashbrew/docker.go
  25. 0 255
      bashbrew/go/src/bashbrew/git.go
  26. 0 63
      bashbrew/go/src/bashbrew/hub.go
  27. 0 378
      bashbrew/go/src/bashbrew/main.go
  28. 0 36
      bashbrew/go/src/bashbrew/manifest-tool.go
  29. 0 198
      bashbrew/go/src/bashbrew/repo.go
  30. 0 148
      bashbrew/go/src/bashbrew/sort.go
  31. 0 2
      bashbrew/go/vendor/github.com/codegangsta/cli/.flake8
  32. 0 2
      bashbrew/go/vendor/github.com/codegangsta/cli/.gitignore
  33. 0 27
      bashbrew/go/vendor/github.com/codegangsta/cli/.travis.yml
  34. 0 435
      bashbrew/go/vendor/github.com/codegangsta/cli/CHANGELOG.md
  35. 0 21
      bashbrew/go/vendor/github.com/codegangsta/cli/LICENSE
  36. 0 1381
      bashbrew/go/vendor/github.com/codegangsta/cli/README.md
  37. 0 497
      bashbrew/go/vendor/github.com/codegangsta/cli/app.go
  38. 0 26
      bashbrew/go/vendor/github.com/codegangsta/cli/appveyor.yml
  39. 0 44
      bashbrew/go/vendor/github.com/codegangsta/cli/category.go
  40. 0 22
      bashbrew/go/vendor/github.com/codegangsta/cli/cli.go
  41. 0 304
      bashbrew/go/vendor/github.com/codegangsta/cli/command.go
  42. 0 278
      bashbrew/go/vendor/github.com/codegangsta/cli/context.go
  43. 0 115
      bashbrew/go/vendor/github.com/codegangsta/cli/errors.go
  44. 0 93
      bashbrew/go/vendor/github.com/codegangsta/cli/flag-types.json
  45. 0 799
      bashbrew/go/vendor/github.com/codegangsta/cli/flag.go
  46. 0 627
      bashbrew/go/vendor/github.com/codegangsta/cli/flag_generated.go
  47. 0 28
      bashbrew/go/vendor/github.com/codegangsta/cli/funcs.go
  48. 0 255
      bashbrew/go/vendor/github.com/codegangsta/cli/generate-flag-types
  49. 0 338
      bashbrew/go/vendor/github.com/codegangsta/cli/help.go
  50. 0 122
      bashbrew/go/vendor/github.com/codegangsta/cli/runtests
  51. 0 191
      bashbrew/go/vendor/github.com/docker-library/go-dockerlibrary/LICENSE
  52. 0 26
      bashbrew/go/vendor/github.com/docker-library/go-dockerlibrary/architecture/oci-platform.go
  53. 0 73
      bashbrew/go/vendor/github.com/docker-library/go-dockerlibrary/manifest/fetch.go
  54. 0 91
      bashbrew/go/vendor/github.com/docker-library/go-dockerlibrary/manifest/line-based.go
  55. 0 24
      bashbrew/go/vendor/github.com/docker-library/go-dockerlibrary/manifest/parse.go
  56. 0 608
      bashbrew/go/vendor/github.com/docker-library/go-dockerlibrary/manifest/rfc2822.go
  57. 0 42
      bashbrew/go/vendor/github.com/docker-library/go-dockerlibrary/pkg/execpipe/execpipe.go
  58. 0 54
      bashbrew/go/vendor/github.com/docker-library/go-dockerlibrary/pkg/stripper/comments.go
  59. 0 8
      bashbrew/go/vendor/github.com/docker-library/go-dockerlibrary/pkg/templatelib/doc.go
  60. 0 138
      bashbrew/go/vendor/github.com/docker-library/go-dockerlibrary/pkg/templatelib/lib.go
  61. 0 41
      bashbrew/go/vendor/github.com/emirpasic/gods/LICENSE
  62. 0 35
      bashbrew/go/vendor/github.com/emirpasic/gods/containers/containers.go
  63. 0 61
      bashbrew/go/vendor/github.com/emirpasic/gods/containers/enumerable.go
  64. 0 109
      bashbrew/go/vendor/github.com/emirpasic/gods/containers/iterator.go
  65. 0 17
      bashbrew/go/vendor/github.com/emirpasic/gods/containers/serialization.go
  66. 0 200
      bashbrew/go/vendor/github.com/emirpasic/gods/lists/arraylist/arraylist.go
  67. 0 79
      bashbrew/go/vendor/github.com/emirpasic/gods/lists/arraylist/enumerable.go
  68. 0 83
      bashbrew/go/vendor/github.com/emirpasic/gods/lists/arraylist/iterator.go
  69. 0 29
      bashbrew/go/vendor/github.com/emirpasic/gods/lists/arraylist/serialization.go
  70. 0 32
      bashbrew/go/vendor/github.com/emirpasic/gods/lists/lists.go
  71. 0 163
      bashbrew/go/vendor/github.com/emirpasic/gods/trees/binaryheap/binaryheap.go
  72. 0 84
      bashbrew/go/vendor/github.com/emirpasic/gods/trees/binaryheap/iterator.go
  73. 0 22
      bashbrew/go/vendor/github.com/emirpasic/gods/trees/binaryheap/serialization.go
  74. 0 21
      bashbrew/go/vendor/github.com/emirpasic/gods/trees/trees.go
  75. 0 251
      bashbrew/go/vendor/github.com/emirpasic/gods/utils/comparator.go
  76. 0 29
      bashbrew/go/vendor/github.com/emirpasic/gods/utils/sort.go
  77. 0 47
      bashbrew/go/vendor/github.com/emirpasic/gods/utils/utils.go
  78. 0 21
      bashbrew/go/vendor/github.com/jbenet/go-context/LICENSE
  79. 0 120
      bashbrew/go/vendor/github.com/jbenet/go-context/io/ctxio.go
  80. 0 1
      bashbrew/go/vendor/github.com/kevinburke/ssh_config/.gitattributes
  81. 0 1
      bashbrew/go/vendor/github.com/kevinburke/ssh_config/.gitignore
  82. 0 15
      bashbrew/go/vendor/github.com/kevinburke/ssh_config/.travis.yml
  83. 0 4
      bashbrew/go/vendor/github.com/kevinburke/ssh_config/AUTHORS.txt
  84. 0 49
      bashbrew/go/vendor/github.com/kevinburke/ssh_config/LICENSE
  85. 0 32
      bashbrew/go/vendor/github.com/kevinburke/ssh_config/Makefile
  86. 0 81
      bashbrew/go/vendor/github.com/kevinburke/ssh_config/README.md
  87. 0 639
      bashbrew/go/vendor/github.com/kevinburke/ssh_config/config.go
  88. 0 241
      bashbrew/go/vendor/github.com/kevinburke/ssh_config/lexer.go
  89. 0 185
      bashbrew/go/vendor/github.com/kevinburke/ssh_config/parser.go
  90. 0 25
      bashbrew/go/vendor/github.com/kevinburke/ssh_config/position.go
  91. 0 49
      bashbrew/go/vendor/github.com/kevinburke/ssh_config/token.go
  92. 0 162
      bashbrew/go/vendor/github.com/kevinburke/ssh_config/validators.go
  93. 0 21
      bashbrew/go/vendor/github.com/mitchellh/go-homedir/LICENSE
  94. 0 14
      bashbrew/go/vendor/github.com/mitchellh/go-homedir/README.md
  95. 0 1
      bashbrew/go/vendor/github.com/mitchellh/go-homedir/go.mod
  96. 0 157
      bashbrew/go/vendor/github.com/mitchellh/go-homedir/homedir.go
  97. 0 1
      bashbrew/go/vendor/github.com/pelletier/go-buffruneio/.gitignore
  98. 0 7
      bashbrew/go/vendor/github.com/pelletier/go-buffruneio/.travis.yml
  99. 0 62
      bashbrew/go/vendor/github.com/pelletier/go-buffruneio/README.md
  100. 0 117
      bashbrew/go/vendor/github.com/pelletier/go-buffruneio/buffruneio.go

+ 0 - 6
.gitignore

@@ -1,7 +1 @@
 .git
-bashbrew/go/bin
-bashbrew/go/pkg
-bashbrew/go/vendor/bin
-bashbrew/go/vendor/pkg
-bashbrew/logs
-bashbrew/src

+ 18 - 17
bashbrew/travis.sh → .travis.sh

@@ -1,14 +1,19 @@
-#!/bin/bash
-set -e
+#!/usr/bin/env bash
+set -Eeuo pipefail
 
-cd "$(dirname "$(readlink -f "$BASH_SOURCE")")"
+dir="$(readlink -f "$BASH_SOURCE")"
+dir="$(dirname "$dir")"
+cd "$dir"
 
 repos=( --all )
 extraCommands=
 
+: "${TRAVIS_PULL_REQUEST:=}"
+: "${TRAVIS_BRANCH:=}"
+
 upstreamRepo='docker-library/official-images'
 upstreamBranch='master'
-if [ "$TRAVIS_PULL_REQUEST" -a "$TRAVIS_PULL_REQUEST" != 'false' ]; then
+if [ -n "$TRAVIS_PULL_REQUEST" ] && [ "$TRAVIS_PULL_REQUEST" != 'false' ]; then
 	upstreamRepo="$TRAVIS_REPO_SLUG"
 	upstreamBranch="$TRAVIS_BRANCH"
 fi
@@ -18,28 +23,24 @@ HEAD="$(git rev-parse --verify HEAD)"
 git fetch -q "https://github.com/$upstreamRepo.git" "refs/heads/$upstreamBranch"
 UPSTREAM="$(git rev-parse --verify FETCH_HEAD)"
 
-if [ "$TRAVIS_BRANCH" = 'master' -a "$TRAVIS_PULL_REQUEST" = 'false' ]; then
+if [ "$TRAVIS_BRANCH" = 'master' ] && [ "$TRAVIS_PULL_REQUEST" = 'false' ]; then
 	# if we're testing master itself, RUN ALL THE THINGS
 	echo >&2 'Testing master -- BUILD ALL THE THINGS!'
-elif [ "$(git diff --numstat "$UPSTREAM...$HEAD" -- ../library | wc -l)" -ne 0 ]; then
+elif libraryChanges="$(git diff --numstat "$UPSTREAM...$HEAD" -- library)" && [ "$(wc -l <<<"$libraryChanges")" -ne 0 ]; then
 	# changes in library/ -- run our extended tests regardless of bashbrew changes
-	repos=( $(git diff --numstat "$UPSTREAM...$HEAD" -- ../library | awk -F '/' '{ print $2 }') )
+	repos=( $(awk -F '/' '{ print $2 }' <<<"$libraryChanges") )
 	extraCommands=1
-elif [ "$(git diff --numstat "$UPSTREAM...$HEAD" -- . | wc -l)" -ne 0 ]; then
-	# changes in bashbrew/ -- keep "--all" so we test the bashbrew script changes appropriately
-	echo >&2 'Changes in bashbrew/ detected!'
-	#extraCommands=1 # TODO this takes a lot of load and often fails (force pushes to maintainer branches, etc)
 else
-	# no changes to library/ or bashbrew/ -- skip tests
+	# no changes to library/ -- skip tests
 	repos=()
 fi
 
 if [ "${#repos[@]}" -eq 0 ]; then
-	echo >&2 'Skipping test builds: no changes to library/ or bashbrew/ in PR'
+	echo >&2 'Skipping test builds: no changes to library/ in PR'
 	exit
 fi
 
-export BASHBREW_LIBRARY="$(dirname "$PWD")/library"
+export BASHBREW_LIBRARY="$PWD/library"
 
 if badTags="$(bashbrew list "${repos[@]}" | grep -E ':.+latest.*|:.*latest.+')" && [ -n "$badTags" ]; then
 	echo >&2
@@ -52,7 +53,7 @@ if badTags="$(bashbrew list "${repos[@]}" | grep -E ':.+latest.*|:.*latest.+')"
 fi
 
 if [ -n "$extraCommands" ]; then
-	naughtyFrom="$(../naughty-from.sh "${repos[@]}")"
+	naughtyFrom="$(./naughty-from.sh "${repos[@]}")"
 	if [ -n "$naughtyFrom" ]; then
 		echo >&2
 		echo >&2 "Invalid 'FROM' + 'Architectures' combinations detected:"
@@ -64,7 +65,7 @@ if [ -n "$extraCommands" ]; then
 		exit 1
 	fi
 
-	naughtyConstraints="$(../naughty-constraints.sh "${repos[@]}")"
+	naughtyConstraints="$(./naughty-constraints.sh "${repos[@]}")"
 	if [ -n "$naughtyConstraints" ]; then
 		echo >&2
 		echo >&2 "Invalid 'FROM' + 'Constraints' combinations detected:"
@@ -74,7 +75,7 @@ if [ -n "$extraCommands" ]; then
 		exit 1
 	fi
 
-	naughtyCommits="$(../naughty-commits.sh "${repos[@]}")"
+	naughtyCommits="$(./naughty-commits.sh "${repos[@]}")"
 	if [ -n "$naughtyCommits" ]; then
 		echo >&2
 		echo >&2 "Unpleasant commits detected:"

+ 8 - 5
.travis.yml

@@ -1,12 +1,15 @@
-language: go
-go: 1.12.x
+language: bash
 
 install:
-    - ./bashbrew/bashbrew.sh --help > /dev/null
-    - export PATH="$PWD/bashbrew/go/bin:$PATH"
+    - mkdir bin
+    - bashbrewVersion="$(< bashbrew-version)"
+    - wget -O bin/bashbrew "https://github.com/docker-library/bashbrew/releases/download/v$bashbrewVersion/bashbrew-amd64"
+    - chmod +x bin/bashbrew
+    - export PATH="$PWD/bin:$PATH"
+    - bashbrew --version
 
 before_script:
     - env | sort
 
 script:
-    - ./bashbrew/travis.sh
+    - ./.travis.sh

+ 2 - 28
Dockerfile

@@ -1,4 +1,5 @@
-FROM tianon/docker-tianon
+# FYI, this base image is built via test-pr.sh (from https://github.com/docker-library/bashbrew/tree/master/Dockerfile)
+FROM oisupport/bashbrew:base
 
 RUN set -eux; \
 	apt-get update; \
@@ -9,37 +10,10 @@ RUN set -eux; \
 # git for cloning source code
 		git \
 	; \
-# go for compiling bashbrew (backports to get new enough version and to make it work on s390x)
-	suite="$(awk '$1 == "deb" && $4 == "main" && $3 !~ /[\/-]/ { print $3; exit }' /etc/apt/sources.list)"; \
-	echo "deb http://deb.debian.org/debian $suite-backports main" > /etc/apt/sources.list.d/backports.list; \
-	apt-get update; \
-	apt-get install -y --no-install-recommends -t "$suite-backports" \
-		golang-go \
-	; \
 	rm -rf /var/lib/apt/lists/*
 
-ENV GOPATH /go
-ENV PATH $GOPATH/bin:$PATH
-
 ENV DIR /usr/src/official-images
-ENV PATH $DIR/bashbrew/go/bin:$PATH
-
 ENV BASHBREW_LIBRARY $DIR/library
-ENV BASHBREW_CACHE /bashbrew-cache
-
-# make sure our default cache dir exists and is writable by anyone (similar to /tmp)
-RUN mkdir -p "$BASHBREW_CACHE" \
-	&& chmod 1777 "$BASHBREW_CACHE"
-# (this allows us to decide at runtime the exact uid/gid we'd like to run as)
 
 WORKDIR $DIR
 COPY . $DIR
-
-RUN set -eux; \
-	CGO_ENABLED=0 ./bashbrew/bashbrew.sh --help > /dev/null; \
-	cp -vL bashbrew/go/bin/bashbrew /usr/local/bin/
-
-VOLUME $BASHBREW_CACHE
-
-RUN ln -s "$PWD/bashbrew/bashbrew-entrypoint.sh" /usr/local/bin/bashbrew-entrypoint.sh
-ENTRYPOINT ["bashbrew-entrypoint.sh"]

+ 2 - 2
README.md

@@ -304,7 +304,7 @@ For image updates which constitute a security fix, there are a few things we rec
 
 #### Multiple Architectures
 
-Each repo can specify multiple architectures for any and all tags. If no architecture is specified, images are built in Linux on `amd64` (aka x86-64). To specify more or different architectures, use the `Architectures` field (comma-delimited list, whitespace is trimmed). Valid architectures are found in [`oci-platform.go`](https://github.com/docker-library/official-images/blob/a7ad3081aa5f51584653073424217e461b72670a/bashbrew/go/vendor/src/github.com/docker-library/go-dockerlibrary/architecture/oci-platform.go#L14-L25):
+Each repo can specify multiple architectures for any and all tags. If no architecture is specified, images are built in Linux on `amd64` (aka x86-64). To specify more or different architectures, use the `Architectures` field (comma-delimited list, whitespace is trimmed). Valid architectures are found in [Bashbrew's `oci-platform.go` file](https://github.com/docker-library/bashbrew/blob/v0.1.0/vendor/github.com/docker-library/go-dockerlibrary/architecture/oci-platform.go#L14-L26):
 
 -	`amd64`
 -	`arm32v6`
@@ -429,4 +429,4 @@ See the [multi-arch section](#multiple-architectures) for details on how to spec
 
 ## Bashbrew
 
-Bashbrew (`bashbrew`) is a tool for cloning, building, tagging, and pushing the Docker official images. See [`README.md` in the `bashbrew/` subfolder](bashbrew/README.md) for more information.
+Bashbrew (`bashbrew`) is a tool for cloning, building, tagging, and pushing the Docker official images. See [the Bashbrew `README`](https://github.com/docker-library/bashbrew#readme) for more information.

+ 1 - 0
bashbrew-version

@@ -0,0 +1 @@
+0.1.0

+ 0 - 37
bashbrew/.bashbrew-arch-to-goenv.sh

@@ -1,37 +0,0 @@
-#!/bin/sh
-set -euo pipefail
-
-# usage: (from within another script)
-#   eval "$(./.bashbrew-arch-to-goenv.sh)"
-# since we need those new environment variables in our other script
-
-bashbrewArch="$1"; shift # "amd64", "arm32v5", "windows-amd64", etc.
-
-os="${bashbrewArch%%-*}"
-[ "$os" != "$bashbrewArch" ] || os='linux'
-printf 'export GOOS="%s"\n' "$os"
-
-arch="${bashbrewArch#${os}-}"
-case "$arch" in
-	arm32v*)
-		printf 'export GOARCH="%s"\n' 'arm'
-		printf 'export GOARM="%s"\n' "${arch#arm32v}"
-		;;
-
-	arm64v*)
-		printf 'export GOARCH="%s"\n' 'arm64'
-		# no GOARM for arm64 (yet?) -- https://github.com/golang/go/blob/1e72bf62183ea21b9affffd4450d44d994393899/src/cmd/internal/objabi/util.go#L40
-		#printf 'export GOARM="%s"\n' "${arch#arm64v}"
-		printf 'unset GOARM\n'
-		;;
-
-	i386)
-		printf 'export GOARCH="%s"\n' '386'
-		printf 'unset GOARM\n'
-		;;
-
-	*)
-		printf 'export GOARCH="%s"\n' "$arch"
-		printf 'unset GOARM\n'
-		;;
-esac

+ 0 - 6
bashbrew/.dockerignore

@@ -1,6 +0,0 @@
-*.md
-*.sh
-.dockerignore
-Dockerfile*
-go/bin
-!.bashbrew-arch-to-goenv.sh

+ 0 - 85
bashbrew/Dockerfile.release

@@ -1,85 +0,0 @@
-FROM golang:1.13-alpine3.11
-
-RUN apk add --no-cache \
-		file \
-		gnupg
-
-WORKDIR /usr/src/bashbrew
-ENV CGO_ENABLED 0
-
-ENV BASHBREW_ARCHES \
-		amd64 \
-		arm32v5 \
-		arm32v6 \
-		arm32v7 \
-		arm64v8 \
-		darwin-amd64 \
-		i386 \
-		mips64le \
-		ppc64le \
-		s390x \
-		windows-amd64
-
-COPY .bashbrew-arch-to-goenv.sh /usr/local/bin/
-
-# https://github.com/estesp/manifest-tool/releases
-ENV MANIFEST_TOOL_VERSION 1.0.2
-# gpg: key 0F386284C03A1162: public key "Philip Estes <[email protected]>" imported
-ENV MANIFEST_TOOL_GPG_KEY 27F3EA268A97867EAF0BD05C0F386284C03A1162
-
-RUN set -euxo pipefail; \
-	\
-	export GNUPGHOME="$(mktemp -d)"; \
-	gpg --batch --keyserver ha.pool.sks-keyservers.net --recv-keys "$MANIFEST_TOOL_GPG_KEY"; \
-	\
-	mkdir -p bin; \
-	\
-	for bashbrewArch in $BASHBREW_ARCHES; do \
-		( \
-			goEnv="$(.bashbrew-arch-to-goenv.sh "$bashbrewArch")"; eval "$goEnv"; \
-			srcBin="manifest-tool-$GOOS-$GOARCH"; \
-			if [ "$GOARCH" = 'arm' ]; then [ -n "$GOARM" ]; srcBin="${srcBin}v$GOARM"; fi; \
-			[ "$GOOS" = 'windows' ] && ext='.exe' || ext=; \
-			srcBin="$srcBin$ext"; \
-			targetBin="bin/manifest-tool-$bashbrewArch$ext"; \
-			wget -O "$targetBin.asc" "https://github.com/estesp/manifest-tool/releases/download/v${MANIFEST_TOOL_VERSION}/$srcBin.asc"; \
-			wget -O "$targetBin" "https://github.com/estesp/manifest-tool/releases/download/v${MANIFEST_TOOL_VERSION}/$srcBin"; \
-			gpg --batch --verify "$targetBin.asc" "$targetBin"; \
-			ls -lAFh "$targetBin"*; \
-			file "$targetBin"*; \
-		) \
-	done; \
-	\
-	gpgconf --kill all; \
-	rm -r "$GNUPGHOME"; \
-	\
-	ls -lAFh bin/manifest-tool-*; \
-	file bin/manifest-tool-*
-
-COPY go .
-
-RUN set -euxo pipefail; \
-	\
-	mkdir -p bin; \
-	\
-	for bashbrewArch in $BASHBREW_ARCHES; do \
-		( \
-			goEnv="$(.bashbrew-arch-to-goenv.sh "$bashbrewArch")"; eval "$goEnv"; \
-			[ "$GOOS" = 'windows' ] && ext='.exe' || ext=; \
-			\
-			targetBin="bin/bashbrew-$bashbrewArch$ext"; \
-			go build \
-				-a -v \
-				-ldflags '-s -w' \
-				-tags netgo -installsuffix netgo \
-				-o "$targetBin" \
-				-mod vendor \
-				bashbrew/src/bashbrew \
-			; \
-			ls -lAFh "$targetBin"; \
-			file "$targetBin"; \
-		) \
-	done; \
-	\
-	ls -lAFh bin/bashbrew-*; \
-	file bin/bashbrew-*

+ 0 - 88
bashbrew/README.md

@@ -1,88 +0,0 @@
-# Bashbrew (`bashbrew`)
-
-[![Jenkins Build Status](https://doi-janky.infosiftr.net/job/bashbrew/badge/icon)](https://doi-janky.infosiftr.net/job/bashbrew/)
-
-```console
-$ bashbrew --help
-NAME:
-   bashbrew - canonical build tool for the official images
-
-USAGE:
-   bashbrew [global options] command [command options] [arguments...]
-
-COMMANDS:
-     list, ls    list repo:tag combinations for a given repo
-     build       build (and tag) repo:tag combinations for a given repo
-     tag         tag repo:tag into a namespace (especially for pushing)
-     push        push namespace/repo:tag (see also "tag")
-     put-shared  update shared tags in the registry (and multi-architecture tags)
-     help, h     Shows a list of commands or help for one command
-   plumbing:
-     children, offspring, descendants, progeny  print the repos built FROM a given repo or repo:tag
-     parents, ancestors, progenitors            print the repos this repo or repo:tag is FROM
-     cat                                        print manifest contents for repo or repo:tag
-     from                                       print FROM for repo:tag
-
-GLOBAL OPTIONS:
-   --debug                  enable more output (esp. all "docker build" output instead of only output on failure) [$BASHBREW_DEBUG]
-   --no-sort                do not apply any sorting, even via --build-order
-   --arch value             the current platform architecture (default: "amd64") [$BASHBREW_ARCH]
-   --constraint value       build constraints (see Constraints in Manifest2822Entry) [$BASHBREW_CONSTRAINTS]
-   --exclusive-constraints  skip entries which do not have Constraints
-   --arch-namespace value   architecture to push namespace mappings for creating indexes/manifest lists ("arch=namespace" ala "s390x=tianons390x") [$BASHBREW_ARCH_NAMESPACES]
-   --config value           where default "flags" configuration can be overridden more persistently (default: "/home/tianon/.config/bashbrew") [$BASHBREW_CONFIG]
-   --library value          where the bodies are buried (default: "/home/tianon/docker/official-images/library") [$BASHBREW_LIBRARY]
-   --cache value            where the git wizardry is stashed (default: "/home/tianon/.cache/bashbrew") [$BASHBREW_CACHE]
-   --help, -h, -?           show help
-```
-
-## Installing
-
-Pre-built binaries are available to [download from Jenkins (for a large variety of supported architectures)](https://doi-janky.infosiftr.net/job/bashbrew/lastSuccessfulBuild/artifact/bin/).
-
-For building `bashbrew` yourself, there are clues in [`bashbrew.sh`](bashbrew.sh) and [`.travis.yml`](../.travis.yml) (although it's a pretty standard Go application).
-
-## Usage
-
-Docker version 1.10 or above is required for use of Bashbrew.
-
-In general, `bashbrew build some-repo` or `bashbrew build ./some-file` should be sufficient for using the tool at a surface level, especially for testing. For more complex usage, please see the built-in help (`bashbrew --help`, `bashbrew build --help`, etc).
-
-## Configuration
-
-The default "flags" configuration is in `~/.config/bashbrew/flags`, but the base path can be overridden with `--config` or `BASHBREW_CONFIG` (technically, the full path to the `flags` configuration file is `${BASHBREW_CONFIG:-${XDG_CONFIG_HOME:-$HOME/.config}/bashbrew}/flags`).
-
-To set a default namespace for specific commands only:
-
-```
-Commands: tag, push
-Namespace: officialstaging
-```
-
-To set a default namespace for all commands:
-
-```
-Namespace: jsmith
-```
-
-A more complex example:
-
-```
-# comments are allowed anywhere (and are ignored)
-Library: /mnt/docker/official-images/library
-Cache: /mnt/docker/bashbrew-cache
-Constraints: aufs, docker-1.9, tianon
-ExclusiveConstraints: true
-
-# namespace just "tag" and "push" (not "build")
-Commands: tag, push
-Namespace: tianon
-
-Commands: list
-ApplyConstraints: true
-
-Commands: tag
-Debug: true
-```
-
-In this example, `bashbrew tag` will get both `Namespace` and `Debug` applied.

+ 0 - 14
bashbrew/bashbrew-entrypoint.sh

@@ -1,14 +0,0 @@
-#!/bin/sh
-set -e
-
-if [ "${1#-}" != "$1" ]; then
-	set -- bashbrew "$@"
-fi
-
-# if our command is a valid bashbrew subcommand, let's invoke it through bashbrew instead
-# (this allows for "docker run bashbrew build", etc)
-if bashbrew "$1" --help > /dev/null 2>&1; then
-	set -- bashbrew "$@"
-fi
-
-exec "$@"

+ 0 - 13
bashbrew/bashbrew.sh

@@ -1,13 +0,0 @@
-#!/usr/bin/env bash
-set -Eeuo pipefail
-
-dir="$(readlink -f "$BASH_SOURCE")"
-dir="$(dirname "$dir")"
-
-export GO111MODULE=on
-(
-	cd "$dir/go"
-	go build -o bin/bashbrew -mod vendor bashbrew/src/bashbrew > /dev/null
-)
-
-exec "$dir/go/bin/bashbrew" "$@"

+ 0 - 15
bashbrew/go/go.mod

@@ -1,15 +0,0 @@
-module bashbrew
-
-go 1.13
-
-require (
-	github.com/codegangsta/cli v1.20.0
-	github.com/docker-library/go-dockerlibrary v0.0.0-20200415185511-8f28c0fe22db
-	golang.org/x/crypto v0.0.0-20190611184440-5c40567a22f8 // indirect
-	golang.org/x/net v0.0.0-20190613194153-d28f0bde5980 // indirect
-	golang.org/x/sys v0.0.0-20190613124609-5ed2794edfdc // indirect
-	golang.org/x/text v0.3.2 // indirect
-	gopkg.in/src-d/go-git.v4 v4.11.0
-	pault.ag/go/debian v0.0.0-20190109175134-a131cb0ae041
-	pault.ag/go/topsort v0.0.0-20160530003732-f98d2ad46e1a
-)

+ 0 - 81
bashbrew/go/go.sum

@@ -1,81 +0,0 @@
-github.com/alcortesm/tgz v0.0.0-20161220082320-9c5fe88206d7 h1:uSoVVbwJiQipAclBbw+8quDsfcvFjOpI5iCf4p/cqCs=
-github.com/alcortesm/tgz v0.0.0-20161220082320-9c5fe88206d7/go.mod h1:6zEj6s6u/ghQa61ZWa/C2Aw3RkjiTBOix7dkqa1VLIs=
-github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239 h1:kFOfPq6dUM1hTo4JG6LR5AXSUEsOjtdm0kw0FtQtMJA=
-github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239/go.mod h1:2FmKhYUyUczH0OGQWaF5ceTx0UBShxjsH6f8oGKYe2c=
-github.com/codegangsta/cli v1.20.0 h1:iX1FXEgwzd5+XN6wk5cVHOGQj6Q3Dcp20lUeS4lHNTw=
-github.com/codegangsta/cli v1.20.0/go.mod h1:/qJNoX69yVSKu5o4jLyXAENLRyk1uhi7zkbQ3slBdOA=
-github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
-github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
-github.com/docker-library/go-dockerlibrary v0.0.0-20200415185511-8f28c0fe22db h1:qxSDuZDqrt7X9gU75CD3GliYYSMLbHcO69VP7XWmoxk=
-github.com/docker-library/go-dockerlibrary v0.0.0-20200415185511-8f28c0fe22db/go.mod h1:ijRhN3WM71dD8TfohKoUdX46BT2uz/Ek5O+5PINI880=
-github.com/emirpasic/gods v1.9.0 h1:rUF4PuzEjMChMiNsVjdI+SyLu7rEqpQ5reNFnhC7oFo=
-github.com/emirpasic/gods v1.9.0/go.mod h1:YfzfFFoVP/catgzJb4IKIqXjX78Ha8FMSDh3ymbK86o=
-github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568 h1:BHsljHzVlRcyQhjrss6TZTdY2VfCqZPbv5k3iBFa2ZQ=
-github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc=
-github.com/gliderlabs/ssh v0.1.1 h1:j3L6gSLQalDETeEg/Jg0mGY0/y/N6zI2xX1978P0Uqw=
-github.com/gliderlabs/ssh v0.1.1/go.mod h1:U7qILu1NlMHj9FlMhZLlkCdDnU1DBEAqr0aevW3Awn0=
-github.com/google/go-cmp v0.2.0 h1:+dTQ8DZQJz0Mb/HjFlkptS1FeQ4cWSnN941F8aEG4SQ=
-github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
-github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 h1:BQSFePA1RWJOlocH6Fxy8MmwDt+yVQYULKfN0RoTN8A=
-github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99/go.mod h1:1lJo3i6rXxKeerYnT8Nvf0QmHCRC1n8sfWVwXF2Frvo=
-github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI=
-github.com/kevinburke/ssh_config v0.0.0-20180830205328-81db2a75821e h1:RgQk53JHp/Cjunrr1WlsXSZpqXn+uREuHvUVcK82CV8=
-github.com/kevinburke/ssh_config v0.0.0-20180830205328-81db2a75821e/go.mod h1:CT57kijsi8u/K/BOFA39wgDQJ9CxiF4nAY/ojJ6r6mM=
-github.com/kjk/lzma v0.0.0-20161016003348-3fd93898850d/go.mod h1:phT/jsRPBAEqjAibu1BurrabCBNTYiVI+zbmyCZJY6Q=
-github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=
-github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
-github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
-github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
-github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
-github.com/mitchellh/go-homedir v1.0.0 h1:vKb8ShqSby24Yrqr/yDYkuFz8d0WUjys40rvnGC8aR0=
-github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0=
-github.com/pelletier/go-buffruneio v0.2.0 h1:U4t4R6YkofJ5xHm3dJzuRpPZ0mr5MMCoAWooScCR7aA=
-github.com/pelletier/go-buffruneio v0.2.0/go.mod h1:JkE26KsDizTr40EUHkXVtNPvgGtbSNq5BcowyYOWdKo=
-github.com/pkg/errors v0.8.0 h1:WdK/asTD0HN+q6hsWO3/vpuAkAr+tw6aNJNDFFf0+qw=
-github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
-github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
-github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
-github.com/sergi/go-diff v1.0.0 h1:Kpca3qRNrduNnOQeazBd0ysaKrUJiIuISHxogkT9RPQ=
-github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo=
-github.com/src-d/gcfg v1.4.0 h1:xXbNR5AlLSA315x2UO+fTSSAXCDf+Ar38/6oyGbDKQ4=
-github.com/src-d/gcfg v1.4.0/go.mod h1:p/UMsR43ujA89BJY9duynAwIpvqEujIH/jFlfL7jWoI=
-github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w=
-github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
-github.com/xanzy/ssh-agent v0.2.0 h1:Adglfbi5p9Z0BmK2oKU9nTG+zKfniSfnaMYB+ULd+Ro=
-github.com/xanzy/ssh-agent v0.2.0/go.mod h1:0NyE30eGUDliuLEHJgYte/zncp2zdTStcOnWhgSqHD8=
-github.com/xi2/xz v0.0.0-20171230120015-48954b6210f8/go.mod h1:HUYIGzjTL3rfEspMxjDjgmT5uz5wzYJKVo23qUhYTos=
-golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
-golang.org/x/crypto v0.0.0-20190103213133-ff983b9c42bc/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
-golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
-golang.org/x/crypto v0.0.0-20190611184440-5c40567a22f8 h1:1wopBVtVdWnn03fZelqdXTqk7U7zPQCb+T4rbU9ZEoU=
-golang.org/x/crypto v0.0.0-20190611184440-5c40567a22f8/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
-golang.org/x/net v0.0.0-20180906233101-161cd47e91fd h1:nTDtHvHSdCn1m6ITfMRqtOd/9+7a3s8RBNOZ3eYZzJA=
-golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
-golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
-golang.org/x/net v0.0.0-20190613194153-d28f0bde5980 h1:dfGZHvZk057jK2MCeWus/TowKpJ8y4AmooUzdBSR9GU=
-golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
-golang.org/x/sys v0.0.0-20180903190138-2b024373dcd9/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
-golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a h1:1BGLXjeY4akVXGgbC9HugT3Jv3hCI0z56oJR5vAMgBU=
-golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
-golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
-golang.org/x/sys v0.0.0-20190613124609-5ed2794edfdc h1:x+/QxSNkVFAC+v4pL1f6mZr1z+qgi+FoR8ccXZPVC10=
-golang.org/x/sys v0.0.0-20190613124609-5ed2794edfdc/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
-golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg=
-golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
-golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs=
-golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
-golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
-gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY=
-gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
-gopkg.in/src-d/go-billy.v4 v4.2.1 h1:omN5CrMrMcQ+4I8bJ0wEhOBPanIRWzFC953IiXKdYzo=
-gopkg.in/src-d/go-billy.v4 v4.2.1/go.mod h1:tm33zBoOwxjYHZIE+OV8bxTWFMJLrconzFMd38aARFk=
-gopkg.in/src-d/go-git-fixtures.v3 v3.1.1 h1:XWW/s5W18RaJpmo1l0IYGqXKuJITWRFuA45iOf1dKJs=
-gopkg.in/src-d/go-git-fixtures.v3 v3.1.1/go.mod h1:dLBcvytrw/TYZsNTWCnkNF2DSIlzWYqTe3rJR56Ac7g=
-gopkg.in/src-d/go-git.v4 v4.11.0 h1:cJwWgJ0DXifrNrXM6RGN1Y2yR60Rr1zQ9Q5DX5S9qgU=
-gopkg.in/src-d/go-git.v4 v4.11.0/go.mod h1:Vtut8izDyrM8BUVQnzJ+YvmNcem2J89EmfZYCkLokZk=
-gopkg.in/warnings.v0 v0.1.2 h1:wFXVbFY8DY5/xOe1ECiWdKCzZlxgshcYVNkBHstARME=
-gopkg.in/warnings.v0 v0.1.2/go.mod h1:jksf8JmL6Qr/oQM2OXTHunEvvTAsrWBLb6OOjuVWRNI=
-pault.ag/go/debian v0.0.0-20190109175134-a131cb0ae041 h1:LmTwXQVDWXMigTB88hFtd6mc3l5eLAlgdtfPI0F69bQ=
-pault.ag/go/debian v0.0.0-20190109175134-a131cb0ae041/go.mod h1:e7Gva9AMoKtUKYJ1G9kIesbh+4VS2JnAOS8VWafyTCk=
-pault.ag/go/topsort v0.0.0-20160530003732-f98d2ad46e1a h1:WwS7vlB5H2AtwKj1jsGwp2ZLud1x6WXRXh2fXsRqrcA=
-pault.ag/go/topsort v0.0.0-20160530003732-f98d2ad46e1a/go.mod h1:INqx0ClF7kmPAMk2zVTX8DRnhZ/yaA/Mg52g8KFKE7k=

+ 0 - 119
bashbrew/go/src/bashbrew/cmd-build.go

@@ -1,119 +0,0 @@
-package main
-
-import (
-	"fmt"
-
-	"github.com/codegangsta/cli"
-)
-
-func cmdBuild(c *cli.Context) error {
-	repos, err := repos(c.Bool("all"), c.Args()...)
-	if err != nil {
-		return cli.NewMultiError(fmt.Errorf(`failed gathering repo list`), err)
-	}
-
-	repos, err = sortRepos(repos, true)
-	if err != nil {
-		return cli.NewMultiError(fmt.Errorf(`failed sorting repo list`), err)
-	}
-
-	uniq := c.Bool("uniq")
-	pull := c.String("pull")
-	switch pull {
-	case "always", "missing", "never":
-		// legit
-	default:
-		return fmt.Errorf(`invalid value for --pull: %q`, pull)
-	}
-	dryRun := c.Bool("dry-run")
-
-	for _, repo := range repos {
-		r, err := fetch(repo)
-		if err != nil {
-			return cli.NewMultiError(fmt.Errorf(`failed fetching repo %q`, repo), err)
-		}
-
-		entries, err := r.SortedEntries(true)
-		if err != nil {
-			return cli.NewMultiError(fmt.Errorf(`failed sorting entries list for %q`, repo), err)
-		}
-
-		for _, entry := range entries {
-			if r.SkipConstraints(entry) {
-				continue
-			}
-
-			froms, err := r.DockerFroms(entry)
-			if err != nil {
-				return cli.NewMultiError(fmt.Errorf(`failed fetching/scraping FROM for %q (tags %q)`, r.RepoName, entry.TagsString()), err)
-			}
-
-			for _, from := range froms {
-				if from != "scratch" && pull != "never" {
-					doPull := false
-					switch pull {
-					case "always":
-						doPull = true
-					case "missing":
-						_, err := dockerInspect("{{.Id}}", from)
-						doPull = (err != nil)
-					default:
-						return fmt.Errorf(`unexpected value for --pull: %s`, pull)
-					}
-					if doPull {
-						// TODO detect if "from" is something we've built (ie, "python:3-onbuild" is "FROM python:3" but we don't want to pull "python:3" if we "bashbrew build python")
-						fmt.Printf("Pulling %s (%s)\n", from, r.EntryIdentifier(entry))
-						if !dryRun {
-							dockerPull(from)
-						}
-					}
-				}
-			}
-
-			cacheTag, err := r.DockerCacheName(entry)
-			if err != nil {
-				return cli.NewMultiError(fmt.Errorf(`failed calculating "cache hash" for %q (tags %q)`, r.RepoName, entry.TagsString()), err)
-			}
-
-			// check whether we've already built this artifact
-			_, err = dockerInspect("{{.Id}}", cacheTag)
-			if err != nil {
-				fmt.Printf("Building %s (%s)\n", cacheTag, r.EntryIdentifier(entry))
-				if !dryRun {
-					commit, err := r.fetchGitRepo(arch, entry)
-					if err != nil {
-						return cli.NewMultiError(fmt.Errorf(`failed fetching git repo for %q (tags %q)`, r.RepoName, entry.TagsString()), err)
-					}
-
-					archive, err := gitArchive(commit, entry.ArchDirectory(arch))
-					if err != nil {
-						return cli.NewMultiError(fmt.Errorf(`failed generating git archive for %q (tags %q)`, r.RepoName, entry.TagsString()), err)
-					}
-					defer archive.Close()
-
-					// TODO use "meta.StageNames" to do "docker build --target" so we can tag intermediate stages too for cache (streaming "git archive" directly to "docker build" makes that a little hard to accomplish without re-streaming)
-
-					err = dockerBuild(cacheTag, entry.ArchFile(arch), archive)
-					if err != nil {
-						return cli.NewMultiError(fmt.Errorf(`failed building %q (tags %q)`, r.RepoName, entry.TagsString()), err)
-					}
-					archive.Close() // be sure this happens sooner rather than later (defer might take a while, and we want to reap zombies more aggressively)
-				}
-			} else {
-				fmt.Printf("Using %s (%s)\n", cacheTag, r.EntryIdentifier(entry))
-			}
-
-			for _, tag := range r.Tags(namespace, uniq, entry) {
-				fmt.Printf("Tagging %s\n", tag)
-				if !dryRun {
-					err := dockerTag(cacheTag, tag)
-					if err != nil {
-						return cli.NewMultiError(fmt.Errorf(`failed tagging %q as %q`, cacheTag, tag), err)
-					}
-				}
-			}
-		}
-	}
-
-	return nil
-}

+ 0 - 116
bashbrew/go/src/bashbrew/cmd-cat.go

@@ -1,116 +0,0 @@
-package main
-
-import (
-	"bytes"
-	"fmt"
-	"io/ioutil"
-	"strings"
-	"text/template"
-
-	"github.com/codegangsta/cli"
-	"github.com/docker-library/go-dockerlibrary/manifest"
-	"github.com/docker-library/go-dockerlibrary/pkg/templatelib"
-)
-
-var DefaultCatFormat = `
-{{- if i -}}
-	{{- "\n\n" -}}
-{{- end -}}
-{{- with .TagEntries -}}
-	{{- range $i, $e := . -}}
-		{{- if $i -}}{{- "\n\n" -}}{{- end -}}
-		{{- $e -}}
-	{{- end -}}
-{{- else -}}
-	{{- .Manifest -}}
-{{- end -}}
-`
-
-func cmdCat(c *cli.Context) error {
-	repos, err := repos(c.Bool("all"), c.Args()...)
-	if err != nil {
-		return cli.NewMultiError(fmt.Errorf(`failed gathering repo list`), err)
-	}
-
-	format := c.String("format")
-	formatFile := c.String("format-file")
-
-	templateName := "--format"
-	tmplMultiErr := fmt.Errorf(`failed parsing --format %q`, format)
-	if formatFile != "" {
-		b, err := ioutil.ReadFile(formatFile)
-		if err != nil {
-			return cli.NewMultiError(fmt.Errorf(`failed reading --format-file %q`, formatFile), err)
-		}
-		templateName = formatFile
-		tmplMultiErr = fmt.Errorf(`failed parsing --format-file %q`, formatFile)
-		format = string(b)
-	}
-
-	var i int
-	tmpl, err := template.New(templateName).Funcs(templatelib.FuncMap).Funcs(template.FuncMap{
-		"i": func() int {
-			return i
-		},
-		"arch": func() string {
-			return arch
-		},
-		"namespace": func() string {
-			return namespace
-		},
-		"archNamespace": func(arch string) string {
-			return archNamespaces[arch]
-		},
-		"archFilter": func(arch string, entriesArg ...interface{}) []manifest.Manifest2822Entry {
-			if len(entriesArg) < 1 {
-				panic(`"archFilter" requires at least one argument`)
-			}
-			entries := []manifest.Manifest2822Entry{}
-			for _, entryArg := range entriesArg {
-				switch v := entryArg.(type) {
-				case []*manifest.Manifest2822Entry:
-					for _, e := range v {
-						entries = append(entries, *e)
-					}
-				case []manifest.Manifest2822Entry:
-					entries = append(entries, v...)
-				case manifest.Manifest2822Entry:
-					entries = append(entries, v)
-				default:
-					panic(fmt.Sprintf(`"archFilter" encountered unknown type: %T`, v))
-				}
-			}
-			filtered := []manifest.Manifest2822Entry{}
-			for _, entry := range entries {
-				if entry.HasArchitecture(arch) {
-					filtered = append(filtered, entry)
-				}
-			}
-			return filtered
-		},
-	}).Parse(format)
-	if err != nil {
-		return cli.NewMultiError(tmplMultiErr, err)
-	}
-
-	var repo string
-	for i, repo = range repos {
-		r, err := fetch(repo)
-		if err != nil {
-			return cli.NewMultiError(fmt.Errorf(`failed fetching repo %q`, repo), err)
-		}
-
-		buf := &bytes.Buffer{}
-		err = tmpl.ExecuteTemplate(buf, templateName, r)
-		if err != nil {
-			return cli.NewMultiError(fmt.Errorf(`failed executing template for repo %q`, repo), err)
-		}
-		out := buf.String()
-		fmt.Print(out)
-		if !strings.HasSuffix(out, "\n") {
-			fmt.Println()
-		}
-	}
-
-	return nil
-}

+ 0 - 145
bashbrew/go/src/bashbrew/cmd-deps.go

@@ -1,145 +0,0 @@
-package main
-
-import (
-	"fmt"
-
-	"github.com/codegangsta/cli"
-	"pault.ag/go/topsort"
-)
-
-func cmdOffspring(c *cli.Context) error {
-	return cmdFamily(false, c)
-}
-
-func cmdParents(c *cli.Context) error {
-	return cmdFamily(true, c)
-}
-
-type topsortDepthNodes struct {
-	depth int
-	nodes []*topsort.Node
-}
-
-func cmdFamily(parents bool, c *cli.Context) error {
-	depsRepos, err := repos(c.Bool("all"), c.Args()...)
-	if err != nil {
-		return cli.NewMultiError(fmt.Errorf(`failed gathering repo list`), err)
-	}
-
-	uniq := c.Bool("uniq")
-	applyConstraints := c.Bool("apply-constraints")
-	depth := c.Int("depth")
-
-	allRepos, err := repos(true)
-	if err != nil {
-		return cli.NewMultiError(fmt.Errorf(`failed gathering ALL repos list`), err)
-	}
-
-	// create network (all repos)
-	network := topsort.NewNetwork()
-
-	// add nodes
-	for _, repo := range allRepos {
-		r, err := fetch(repo)
-		if err != nil {
-			return cli.NewMultiError(fmt.Errorf(`failed fetching repo %q`, repo), err)
-		}
-
-		for _, entry := range r.Entries() {
-			if applyConstraints && r.SkipConstraints(entry) {
-				continue
-			}
-
-			for _, tag := range r.Tags(namespace, false, entry) {
-				network.AddNode(tag, entry)
-			}
-		}
-	}
-
-	// add edges
-	for _, repo := range allRepos {
-		r, err := fetch(repo)
-		if err != nil {
-			return cli.NewMultiError(fmt.Errorf(`failed fetching repo %q`, repo), err)
-		}
-		for _, entry := range r.Entries() {
-			if applyConstraints && r.SkipConstraints(entry) {
-				continue
-			}
-
-			entryArches := []string{arch}
-			if !applyConstraints {
-				entryArches = entry.Architectures
-			}
-
-			for _, entryArch := range entryArches {
-				froms, err := r.ArchDockerFroms(entryArch, entry)
-				if err != nil {
-					return cli.NewMultiError(fmt.Errorf(`failed fetching/scraping FROM for %q (tags %q, arch %q)`, r.RepoName, entry.TagsString(), entryArch), err)
-				}
-				for _, from := range froms {
-					for _, tag := range r.Tags(namespace, false, entry) {
-						network.AddEdge(from, tag)
-					}
-				}
-			}
-		}
-	}
-
-	// now the real work
-	seen := map[*topsort.Node]bool{}
-	for _, repo := range depsRepos {
-		r, err := fetch(repo)
-		if err != nil {
-			return cli.NewMultiError(fmt.Errorf(`failed fetching repo %q`, repo), err)
-		}
-
-		for _, entry := range r.Entries() {
-			if applyConstraints && r.SkipConstraints(entry) {
-				continue
-			}
-
-			for _, tag := range r.Tags(namespace, uniq, entry) {
-				nodes := []topsortDepthNodes{}
-				if parents {
-					nodes = append(nodes, topsortDepthNodes{
-						depth: 1,
-						nodes: network.Get(tag).InboundEdges,
-					})
-				} else {
-					nodes = append(nodes, topsortDepthNodes{
-						depth: 1,
-						nodes: network.Get(tag).OutboundEdges,
-					})
-				}
-				for len(nodes) > 0 {
-					depthNodes := nodes[0]
-					nodes = nodes[1:]
-					if depth > 0 && depthNodes.depth > depth {
-						continue
-					}
-					for _, node := range depthNodes.nodes {
-						if seen[node] {
-							continue
-						}
-						seen[node] = true
-						fmt.Printf("%s\n", node.Name)
-						if parents {
-							nodes = append(nodes, topsortDepthNodes{
-								depth: depthNodes.depth + 1,
-								nodes: node.InboundEdges,
-							})
-						} else {
-							nodes = append(nodes, topsortDepthNodes{
-								depth: depthNodes.depth + 1,
-								nodes: node.OutboundEdges,
-							})
-						}
-					}
-				}
-			}
-		}
-	}
-
-	return nil
-}

+ 0 - 60
bashbrew/go/src/bashbrew/cmd-from.go

@@ -1,60 +0,0 @@
-package main
-
-import (
-	"fmt"
-	"strings"
-
-	"github.com/codegangsta/cli"
-)
-
-func cmdFrom(c *cli.Context) error {
-	repos, err := repos(c.Bool("all"), c.Args()...)
-	if err != nil {
-		return cli.NewMultiError(fmt.Errorf(`failed gathering repo list`), err)
-	}
-
-	uniq := c.Bool("uniq")
-	applyConstraints := c.Bool("apply-constraints")
-
-	for _, repo := range repos {
-		r, err := fetch(repo)
-		if err != nil {
-			return cli.NewMultiError(fmt.Errorf(`failed fetching repo %q`, repo), err)
-		}
-
-		for _, entry := range r.Entries() {
-			if applyConstraints && r.SkipConstraints(entry) {
-				continue
-			}
-
-			entryArches := []string{arch}
-			if !applyConstraints {
-				entryArches = entry.Architectures
-			}
-
-			froms := []string{}
-			for _, entryArch := range entryArches {
-				archFroms, err := r.ArchDockerFroms(entryArch, entry)
-				if err != nil {
-					return cli.NewMultiError(fmt.Errorf(`failed fetching/scraping FROM for %q (tags %q, arch %q)`, r.RepoName, entry.TagsString(), entryArch), err)
-				}
-			ArchFroms:
-				for _, archFrom := range archFroms {
-					for _, from := range froms {
-						if from == archFrom {
-							continue ArchFroms
-						}
-					}
-					froms = append(froms, archFrom)
-				}
-			}
-
-			fromsString := strings.Join(froms, " ")
-			for _, tag := range r.Tags(namespace, uniq, entry) {
-				fmt.Printf("%s: %s\n", tag, fromsString)
-			}
-		}
-	}
-
-	return nil
-}

+ 0 - 67
bashbrew/go/src/bashbrew/cmd-list.go

@@ -1,67 +0,0 @@
-package main
-
-import (
-	"fmt"
-
-	"github.com/codegangsta/cli"
-	"github.com/docker-library/go-dockerlibrary/manifest"
-)
-
-func cmdList(c *cli.Context) error {
-	repos, err := repos(c.Bool("all"), c.Args()...)
-	if err != nil {
-		return cli.NewMultiError(fmt.Errorf(`failed gathering repo list`), err)
-	}
-
-	uniq := c.Bool("uniq")
-	applyConstraints := c.Bool("apply-constraints")
-	onlyRepos := c.Bool("repos")
-
-	buildOrder := c.Bool("build-order")
-	if buildOrder {
-		repos, err = sortRepos(repos, applyConstraints)
-		if err != nil {
-			return cli.NewMultiError(fmt.Errorf(`failed sorting repo list`), err)
-		}
-	}
-
-	for _, repo := range repos {
-		r, err := fetch(repo)
-		if err != nil {
-			return cli.NewMultiError(fmt.Errorf(`failed fetching repo %q`, repo), err)
-		}
-
-		if onlyRepos {
-			if r.TagEntry == nil {
-				fmt.Printf("%s\n", r.RepoName)
-			} else {
-				for _, tag := range r.Tags(namespace, uniq, r.TagEntry) {
-					fmt.Printf("%s\n", tag)
-				}
-			}
-			continue
-		}
-
-		var entries []*manifest.Manifest2822Entry
-		if buildOrder {
-			entries, err = r.SortedEntries(applyConstraints)
-			if err != nil {
-				return cli.NewMultiError(fmt.Errorf(`failed sorting entries list for %q`, repo), err)
-			}
-		} else {
-			entries = r.Entries()
-		}
-
-		for _, entry := range entries {
-			if applyConstraints && r.SkipConstraints(entry) {
-				continue
-			}
-
-			for _, tag := range r.Tags(namespace, uniq, entry) {
-				fmt.Printf("%s\n", tag)
-			}
-		}
-	}
-
-	return nil
-}

+ 0 - 69
bashbrew/go/src/bashbrew/cmd-push.go

@@ -1,69 +0,0 @@
-package main
-
-import (
-	"fmt"
-	"os"
-	"path"
-	"time"
-
-	"github.com/codegangsta/cli"
-)
-
-func cmdPush(c *cli.Context) error {
-	repos, err := repos(c.Bool("all"), c.Args()...)
-	if err != nil {
-		return cli.NewMultiError(fmt.Errorf(`failed gathering repo list`), err)
-	}
-
-	uniq := c.Bool("uniq")
-	targetNamespace := c.String("target-namespace")
-	dryRun := c.Bool("dry-run")
-	force := c.Bool("force")
-
-	if targetNamespace == "" {
-		targetNamespace = namespace
-	}
-	if targetNamespace == "" {
-		return fmt.Errorf(`either "--target-namespace" or "--namespace" is a required flag for "push"`)
-	}
-
-	for _, repo := range repos {
-		r, err := fetch(repo)
-		if err != nil {
-			return cli.NewMultiError(fmt.Errorf(`failed fetching repo %q`, repo), err)
-		}
-
-		tagRepo := path.Join(targetNamespace, r.RepoName)
-		for _, entry := range r.Entries() {
-			if r.SkipConstraints(entry) {
-				continue
-			}
-
-			// we can't use "r.Tags()" here because it will include SharedTags, which we never want to push directly (see "cmd-put-shared.go")
-			for i, tag := range entry.Tags {
-				if uniq && i > 0 {
-					break
-				}
-				tag = tagRepo + ":" + tag
-
-				if !force {
-					created := dockerCreated(tag)
-					lastUpdated := fetchDockerHubTagMeta(tag).lastUpdatedTime()
-					if !created.After(lastUpdated) {
-						fmt.Fprintf(os.Stderr, "skipping %s (created %s, last updated %s)\n", tag, created.Local().Format(time.RFC3339), lastUpdated.Local().Format(time.RFC3339))
-						continue
-					}
-				}
-				fmt.Printf("Pushing %s\n", tag)
-				if !dryRun {
-					err = dockerPush(tag)
-					if err != nil {
-						return cli.NewMultiError(fmt.Errorf(`failed pushing %q`, tag), err)
-					}
-				}
-			}
-		}
-	}
-
-	return nil
-}

+ 0 - 191
bashbrew/go/src/bashbrew/cmd-put-shared.go

@@ -1,191 +0,0 @@
-package main
-
-import (
-	"fmt"
-	"os"
-	"path"
-	"strings"
-	"time"
-
-	"github.com/codegangsta/cli"
-
-	"github.com/docker-library/go-dockerlibrary/architecture"
-	"github.com/docker-library/go-dockerlibrary/manifest"
-)
-
-func entriesToManifestToolYaml(singleArch bool, r Repo, entries ...*manifest.Manifest2822Entry) (string, time.Time, int, error) {
-	yaml := ""
-	mru := time.Time{}
-	expectedNumber := 0
-	entryIdentifiers := []string{}
-	for _, entry := range entries {
-		entryIdentifiers = append(entryIdentifiers, r.EntryIdentifier(entry))
-
-		for _, entryArch := range entry.Architectures {
-			if singleArch && entryArch != arch {
-				continue
-			}
-
-			var ok bool
-
-			var ociArch architecture.OCIPlatform
-			if ociArch, ok = architecture.SupportedArches[entryArch]; !ok {
-				// this should never happen -- the parser validates Architectures
-				panic("somehow, an unsupported architecture slipped past the parser validation: " + entryArch)
-			}
-
-			var archNamespace string
-			if archNamespace, ok = archNamespaces[entryArch]; !ok || archNamespace == "" {
-				fmt.Fprintf(os.Stderr, "warning: no arch-namespace specified for %q; skipping (%q)\n", entryArch, r.EntryIdentifier(entry))
-				continue
-			}
-
-			archImage := fmt.Sprintf("%s/%s:%s", archNamespace, r.RepoName, entry.Tags[0])
-			archImageMeta := fetchDockerHubTagMeta(archImage)
-			if archU := archImageMeta.lastUpdatedTime(); archU.After(mru) {
-				mru = archU
-			}
-
-			// count up how many images we expect to push successfully in this manifest list
-			expectedNumber += len(archImageMeta.Images)
-			// for non-manifest-list tags, this will be 1 and for failed lookups it'll be 0
-			// (and if one of _these_ tags is a manifest list, we've goofed somewhere)
-			if len(archImageMeta.Images) != 1 {
-				fmt.Fprintf(os.Stderr, "warning: expected 1 image for %q; got %d\n", archImage, len(archImageMeta.Images))
-			}
-
-			yaml += fmt.Sprintf("  - image: %s\n    platform:\n", archImage)
-			yaml += fmt.Sprintf("      os: %s\n", ociArch.OS)
-			yaml += fmt.Sprintf("      architecture: %s\n", ociArch.Architecture)
-			if ociArch.Variant != "" {
-				yaml += fmt.Sprintf("      variant: %s\n", ociArch.Variant)
-			}
-		}
-	}
-
-	return "manifests:\n" + yaml, mru, expectedNumber, nil
-}
-
-func tagsToManifestToolYaml(repo string, tags ...string) string {
-	yaml := fmt.Sprintf("image: %s:%s\n", repo, tags[0])
-	if len(tags) > 1 {
-		yaml += "tags:\n"
-		for _, tag := range tags[1:] {
-			yaml += fmt.Sprintf("  - %s\n", tag)
-		}
-	}
-	return yaml
-}
-
-func cmdPutShared(c *cli.Context) error {
-	repos, err := repos(c.Bool("all"), c.Args()...)
-	if err != nil {
-		return cli.NewMultiError(fmt.Errorf(`failed gathering repo list`), err)
-	}
-
-	dryRun := c.Bool("dry-run")
-	targetNamespace := c.String("target-namespace")
-	force := c.Bool("force")
-	singleArch := c.Bool("single-arch")
-
-	if targetNamespace == "" {
-		targetNamespace = namespace
-	}
-	if targetNamespace == "" {
-		return fmt.Errorf(`either "--target-namespace" or "--namespace" is a required flag for "put-shared"`)
-	}
-
-	for _, repo := range repos {
-		r, err := fetch(repo)
-		if err != nil {
-			return cli.NewMultiError(fmt.Errorf(`failed fetching repo %q`, repo), err)
-		}
-
-		targetRepo := path.Join(targetNamespace, r.RepoName)
-
-		sharedTagGroups := []manifest.SharedTagGroup{}
-
-		if !singleArch {
-			// handle all multi-architecture tags first (regardless of whether they have SharedTags)
-			// turn them into SharedTagGroup objects so all manifest-tool invocations can be handled by a single process/loop
-			for _, entry := range r.Entries() {
-				entryCopy := *entry
-				sharedTagGroups = append(sharedTagGroups, manifest.SharedTagGroup{
-					SharedTags: entry.Tags,
-					Entries:    []*manifest.Manifest2822Entry{&entryCopy},
-				})
-			}
-		}
-
-		// TODO do something smarter with r.TagName (ie, the user has done something crazy like "bashbrew put-shared single-repo:single-tag")
-		if r.TagName == "" {
-			sharedTagGroups = append(sharedTagGroups, r.Manifest.GetSharedTagGroups()...)
-		} else {
-			fmt.Fprintf(os.Stderr, "warning: a single tag was requested -- skipping SharedTags\n")
-		}
-
-		if len(sharedTagGroups) == 0 {
-			continue
-		}
-
-		failed := []string{}
-		for _, group := range sharedTagGroups {
-			yaml, mostRecentPush, expectedNumber, err := entriesToManifestToolYaml(singleArch, *r, group.Entries...)
-			if err != nil {
-				return err
-			}
-
-			if expectedNumber < 1 {
-				// if "expectedNumber" comes back as 0, we've probably got an API issue, so let's count up what we probably _should_ push
-				fmt.Fprintf(os.Stderr, "warning: no images expected to push for %q\n", fmt.Sprintf("%s:%s", targetRepo, group.SharedTags[0]))
-				for _, entry := range group.Entries {
-					expectedNumber += len(entry.Architectures)
-				}
-			}
-
-			tagsToPush := []string{}
-			for _, tag := range group.SharedTags {
-				image := fmt.Sprintf("%s:%s", targetRepo, tag)
-				if !force {
-					hubMeta := fetchDockerHubTagMeta(image)
-					tagUpdated := hubMeta.lastUpdatedTime()
-					doPush := false
-					if mostRecentPush.After(tagUpdated) {
-						// if one of the images that make up the manifest list has been updated since the manifest list was last pushed, we probably need to push
-						doPush = true
-					}
-					if !singleArch && len(hubMeta.Images) != expectedNumber {
-						// if we're supposed to push more (or less) images than the current manifest list contains, we probably need to push
-						// this _should_ already be accounting for tags that haven't been pushed yet (see notes above in "entriesToManifestToolYaml" where this is calculated)
-						doPush = true
-					}
-					if !doPush {
-						fmt.Fprintf(os.Stderr, "skipping %s (created %s, last updated %s)\n", image, mostRecentPush.Local().Format(time.RFC3339), tagUpdated.Local().Format(time.RFC3339))
-						continue
-					}
-				}
-				tagsToPush = append(tagsToPush, tag)
-			}
-
-			if len(tagsToPush) == 0 {
-				continue
-			}
-
-			groupIdentifier := fmt.Sprintf("%s:%s", targetRepo, tagsToPush[0])
-			fmt.Printf("Putting %s\n", groupIdentifier)
-			if !dryRun {
-				tagYaml := tagsToManifestToolYaml(targetRepo, tagsToPush...) + yaml
-				if err := manifestToolPushFromSpec(tagYaml); err != nil {
-					fmt.Fprintf(os.Stderr, "warning: failed putting %s, skipping (collecting errors)\n", groupIdentifier)
-					failed = append(failed, fmt.Sprintf("- %s: %v", groupIdentifier, err))
-					continue
-				}
-			}
-		}
-		if len(failed) > 0 {
-			return fmt.Errorf("failed putting groups:\n%s", strings.Join(failed, "\n"))
-		}
-	}
-
-	return nil
-}

+ 0 - 50
bashbrew/go/src/bashbrew/cmd-tag.go

@@ -1,50 +0,0 @@
-package main
-
-import (
-	"fmt"
-	"path"
-
-	"github.com/codegangsta/cli"
-)
-
-func cmdTag(c *cli.Context) error {
-	repos, err := repos(c.Bool("all"), c.Args()...)
-	if err != nil {
-		return cli.NewMultiError(fmt.Errorf(`failed gathering repo list`), err)
-	}
-
-	uniq := c.Bool("uniq")
-	targetNamespace := c.String("target-namespace")
-	dryRun := c.Bool("dry-run")
-
-	if targetNamespace == "" {
-		return fmt.Errorf(`"--target-namespace" is a required flag for "tag"`)
-	}
-
-	for _, repo := range repos {
-		r, err := fetch(repo)
-		if err != nil {
-			return cli.NewMultiError(fmt.Errorf(`failed fetching repo %q`, repo), err)
-		}
-
-		for _, entry := range r.Entries() {
-			if r.SkipConstraints(entry) {
-				continue
-			}
-
-			for _, tag := range r.Tags("", uniq, entry) {
-				sourceTag := path.Join(namespace, tag)
-				targetTag := path.Join(targetNamespace, tag)
-				fmt.Printf("Tagging %s\n", targetTag)
-				if !dryRun {
-					err = dockerTag(sourceTag, targetTag)
-					if err != nil {
-						return cli.NewMultiError(fmt.Errorf(`failed tagging %q as %q`, sourceTag, targetTag), err)
-					}
-				}
-			}
-		}
-	}
-
-	return nil
-}

+ 0 - 244
bashbrew/go/src/bashbrew/config.go

@@ -1,244 +0,0 @@
-package main
-
-import (
-	"bufio"
-	"bytes"
-	"fmt"
-	"io"
-	"os"
-	"strings"
-
-	"github.com/codegangsta/cli"
-	"github.com/docker-library/go-dockerlibrary/pkg/stripper"
-	"pault.ag/go/debian/control"
-)
-
-type FlagsConfigEntry struct {
-	control.Paragraph
-
-	Commands []string `delim:"," strip:"\n\r\t "`
-
-	Library    string
-	Cache      string
-	Debug      string
-	Unique     string
-	BuildOrder string
-	Pull       string
-
-	Arch                 string
-	Namespace            string
-	Constraints          []string `delim:"," strip:"\n\r\t "`
-	ExclusiveConstraints string
-	ApplyConstraints     string
-
-	// a list of "arch=namespace" mappings for pushing indexes (manifest lists)
-	ArchNamespaces []string `delim:"," strip:"\n\r\t "`
-}
-
-type FlagsConfig map[string]FlagsConfigEntry
-
-func (dst *FlagsConfigEntry) Apply(src FlagsConfigEntry) {
-	if src.Library != "" {
-		dst.Library = src.Library
-	}
-	if src.Cache != "" {
-		dst.Cache = src.Cache
-	}
-	if src.Debug != "" {
-		dst.Debug = src.Debug
-	}
-	if src.Unique != "" {
-		dst.Unique = src.Unique
-	}
-	if src.BuildOrder != "" {
-		dst.BuildOrder = src.BuildOrder
-	}
-	if src.Pull != "" {
-		dst.Pull = src.Pull
-	}
-	if src.Arch != "" {
-		dst.Arch = src.Arch
-	}
-	if src.Namespace != "" {
-		dst.Namespace = src.Namespace
-	}
-	if len(src.Constraints) > 0 {
-		dst.Constraints = src.Constraints[:]
-	}
-	if src.ExclusiveConstraints != "" {
-		dst.ExclusiveConstraints = src.ExclusiveConstraints
-	}
-	if src.ApplyConstraints != "" {
-		dst.ApplyConstraints = src.ApplyConstraints
-	}
-	if len(src.ArchNamespaces) > 0 {
-		dst.ArchNamespaces = src.ArchNamespaces[:]
-	}
-}
-
-func (config FlagsConfigEntry) Vars() map[string]map[string]interface{} {
-	return map[string]map[string]interface{}{
-		"global": {
-			"library": config.Library,
-			"cache":   config.Cache,
-			"debug":   config.Debug,
-
-			"arch":                  config.Arch,
-			"namespace":             config.Namespace,
-			"constraint":            config.Constraints,
-			"exclusive-constraints": config.ExclusiveConstraints,
-
-			"arch-namespace": config.ArchNamespaces,
-		},
-
-		"local": {
-			"uniq":        config.Unique,
-			"build-order": config.BuildOrder,
-			"pull":        config.Pull,
-
-			"apply-constraints": config.ApplyConstraints,
-		},
-	}
-}
-
-func (config FlagsConfig) ApplyTo(cmd string, c *cli.Context) error {
-	entry := config[""]
-	if cmd != "" {
-		entry.Apply(config[cmd])
-	}
-	vars := entry.Vars()
-	if cmd == "" {
-		vars["local"] = vars["global"]
-		vars["global"] = nil
-	}
-	for key, val := range vars["global"] {
-		if !c.GlobalIsSet(key) && !isEnvVarSet(flagEnvVars[key]) {
-			switch val.(type) {
-			case string:
-				strVal := val.(string)
-				if strVal == "" {
-					continue
-				}
-				c.GlobalSet(key, strVal)
-			case []string:
-				strSlice := val.([]string)
-				if len(strSlice) == 0 {
-					continue
-				}
-				for _, valBit := range strSlice {
-					c.GlobalSet(key, valBit)
-				}
-			default:
-				return fmt.Errorf(`unknown value type %T (%s: %+v)`, val, key, val)
-			}
-		}
-	}
-	for key, val := range vars["local"] {
-		if !c.IsSet(key) && !isEnvVarSet(flagEnvVars[key]) {
-			switch val.(type) {
-			case string:
-				strVal := val.(string)
-				if strVal == "" {
-					continue
-				}
-				c.Set(key, strVal)
-			case []string:
-				strSlice := val.([]string)
-				if len(strSlice) == 0 {
-					continue
-				}
-				for _, valBit := range strSlice {
-					c.Set(key, valBit)
-				}
-			default:
-				return fmt.Errorf(`unknown value type %T (%s: %+v)`, val, key, val)
-			}
-		}
-	}
-	return nil
-}
-
-// https://github.com/urfave/cli/blob/73aa67b7a20db7514b1c086866469c49bc93a569/altsrc/flag.go#L237-L251
-func isEnvVarSet(envVars string) bool {
-	for _, envVar := range strings.Split(envVars, ",") {
-		envVar = strings.TrimSpace(envVar)
-		if envVal := os.Getenv(envVar); envVal != "" {
-			// TODO: Can't use this for bools as
-			// set means that it was true or false based on
-			// Bool flag type, should work for other types
-			if len(envVal) > 0 {
-				return true
-			}
-		}
-	}
-
-	return false
-}
-
-func (ce FlagsConfigEntry) String() string {
-	buf := &bytes.Buffer{}
-	e, err := control.NewEncoder(buf)
-	if err == nil {
-		err = e.Encode(&ce)
-		if err == nil {
-			return buf.String()
-		}
-	}
-	return ""
-}
-
-func NewFlagsConfig() *FlagsConfig {
-	return &FlagsConfig{}
-}
-
-func ParseFlagsConfigFile(file string) (*FlagsConfig, error) {
-	config := NewFlagsConfig()
-	return config, config.ParseFile(file)
-}
-
-func ParseFlagsConfig(in io.Reader) (*FlagsConfig, error) {
-	config := NewFlagsConfig()
-	return config, config.Parse(in)
-}
-
-func (c *FlagsConfig) ParseFile(file string) error {
-	f, err := os.Open(file)
-	if err != nil {
-		return err
-	}
-	defer f.Close()
-	return c.Parse(f)
-}
-
-func (c *FlagsConfig) Parse(readerIn io.Reader) error {
-	reader := stripper.NewCommentStripper(readerIn)
-
-	decoder, err := control.NewDecoder(bufio.NewReader(reader), nil)
-	if err != nil {
-		return err
-	}
-
-	for {
-		entry := FlagsConfigEntry{}
-
-		err := decoder.Decode(&entry)
-		if err == io.EOF {
-			break
-		}
-		if err != nil {
-			return err
-		}
-
-		if len(entry.Commands) == 0 {
-			entry.Commands = []string{""}
-		}
-
-		for _, command := range entry.Commands {
-			targetEntry := (*c)[command]
-			targetEntry.Apply(entry)
-			(*c)[command] = targetEntry
-		}
-	}
-
-	return nil
-}

+ 0 - 299
bashbrew/go/src/bashbrew/docker.go

@@ -1,299 +0,0 @@
-package main
-
-import (
-	"bufio"
-	"bytes"
-	"crypto/sha256"
-	"encoding/hex"
-	"fmt"
-	"io"
-	"os"
-	"os/exec"
-	"path"
-	"strconv"
-	"strings"
-
-	"github.com/codegangsta/cli"
-	"github.com/docker-library/go-dockerlibrary/manifest"
-)
-
-type dockerfileMetadata struct {
-	StageFroms     []string          // every image "FROM" instruction value (or the parent stage's FROM value in the case of a named stage)
-	StageNames     []string          // the name of any named stage (in order)
-	StageNameFroms map[string]string // map of stage names to FROM values (or the parent stage's FROM value in the case of a named stage), useful for resolving stage names to FROM values
-
-	Froms []string // every "FROM" or "COPY --from=xxx" value (minus named and/or numbered stages in the case of "--from=")
-}
-
-// this returns the "FROM" value for the last stage (which essentially determines the "base" for the final published image)
-func (r Repo) ArchLastStageFrom(arch string, entry *manifest.Manifest2822Entry) (string, error) {
-	dockerfileMeta, err := r.archDockerfileMetadata(arch, entry)
-	if err != nil {
-		return "", err
-	}
-	return dockerfileMeta.StageFroms[len(dockerfileMeta.StageFroms)-1], nil
-}
-
-func (r Repo) DockerFroms(entry *manifest.Manifest2822Entry) ([]string, error) {
-	return r.ArchDockerFroms(arch, entry)
-}
-
-func (r Repo) ArchDockerFroms(arch string, entry *manifest.Manifest2822Entry) ([]string, error) {
-	dockerfileMeta, err := r.archDockerfileMetadata(arch, entry)
-	if err != nil {
-		return nil, err
-	}
-	return dockerfileMeta.Froms, nil
-}
-
-func (r Repo) dockerfileMetadata(entry *manifest.Manifest2822Entry) (*dockerfileMetadata, error) {
-	return r.archDockerfileMetadata(arch, entry)
-}
-
-var dockerfileMetadataCache = map[string]*dockerfileMetadata{}
-
-func (r Repo) archDockerfileMetadata(arch string, entry *manifest.Manifest2822Entry) (*dockerfileMetadata, error) {
-	commit, err := r.fetchGitRepo(arch, entry)
-	if err != nil {
-		return nil, cli.NewMultiError(fmt.Errorf("failed fetching Git repo for arch %q from entry %q", arch, entry.String()), err)
-	}
-
-	dockerfileFile := path.Join(entry.ArchDirectory(arch), entry.ArchFile(arch))
-
-	cacheKey := strings.Join([]string{
-		commit,
-		dockerfileFile,
-	}, "\n")
-	if meta, ok := dockerfileMetadataCache[cacheKey]; ok {
-		return meta, nil
-	}
-
-	dockerfile, err := gitShow(commit, dockerfileFile)
-	if err != nil {
-		return nil, cli.NewMultiError(fmt.Errorf(`failed "git show" for %q from commit %q`, dockerfileFile, commit), err)
-	}
-
-	meta, err := parseDockerfileMetadata(dockerfile)
-	if err != nil {
-		return nil, cli.NewMultiError(fmt.Errorf(`failed parsing Dockerfile metadata for %q from commit %q`, dockerfileFile, commit), err)
-	}
-
-	dockerfileMetadataCache[cacheKey] = meta
-	return meta, nil
-}
-
-func parseDockerfileMetadata(dockerfile string) (*dockerfileMetadata, error) {
-	meta := &dockerfileMetadata{
-		// panic: assignment to entry in nil map
-		StageNameFroms: map[string]string{},
-		// (nil slices work fine)
-	}
-
-	scanner := bufio.NewScanner(strings.NewReader(dockerfile))
-	for scanner.Scan() {
-		line := strings.TrimSpace(scanner.Text())
-
-		if line == "" {
-			// ignore blank lines
-			continue
-		}
-
-		if line[0] == '#' {
-			// TODO handle "escape" parser directive
-			// TODO handle "syntax" parser directive -- explode appropriately (since custom syntax invalidates our Dockerfile parsing)
-			// ignore comments
-			continue
-		}
-
-		// handle line continuations
-		// (TODO see note above regarding "escape" parser directive)
-		for line[len(line)-1] == '\\' && scanner.Scan() {
-			nextLine := strings.TrimSpace(scanner.Text())
-			if nextLine == "" || nextLine[0] == '#' {
-				// ignore blank lines and comments
-				continue
-			}
-			line = line[0:len(line)-1] + nextLine
-		}
-
-		fields := strings.Fields(line)
-		if len(fields) < 1 {
-			// must be a much more complex empty line??
-			continue
-		}
-		instruction := strings.ToUpper(fields[0])
-
-		// TODO balk at ARG / $ in from values
-
-		switch instruction {
-		case "FROM":
-			from := fields[1]
-
-			if stageFrom, ok := meta.StageNameFroms[from]; ok {
-				// if this is a valid stage name, we should resolve it back to the original FROM value of that previous stage (we don't care about inter-stage dependencies for the purposes of either tag dependency calculation or tag building -- just how many there are and what external things they require)
-				from = stageFrom
-			}
-
-			// make sure to add ":latest" if it's implied
-			from = latestizeRepoTag(from)
-
-			meta.StageFroms = append(meta.StageFroms, from)
-			meta.Froms = append(meta.Froms, from)
-
-			if len(fields) == 4 && strings.ToUpper(fields[2]) == "AS" {
-				stageName := fields[3]
-				meta.StageNames = append(meta.StageNames, stageName)
-				meta.StageNameFroms[stageName] = from
-			}
-		case "COPY":
-			for _, arg := range fields[1:] {
-				if !strings.HasPrefix(arg, "--") {
-					// doesn't appear to be a "flag"; time to bail!
-					break
-				}
-				if !strings.HasPrefix(arg, "--from=") {
-					// ignore any flags we're not interested in
-					continue
-				}
-				from := arg[len("--from="):]
-
-				if stageFrom, ok := meta.StageNameFroms[from]; ok {
-					// see note above regarding stage names in FROM
-					from = stageFrom
-				} else if stageNumber, err := strconv.Atoi(from); err == nil && stageNumber < len(meta.StageFroms) {
-					// must be a stage number, we should resolve it too
-					from = meta.StageFroms[stageNumber]
-				}
-
-				// make sure to add ":latest" if it's implied
-				from = latestizeRepoTag(from)
-
-				meta.Froms = append(meta.Froms, from)
-			}
-		}
-	}
-	if err := scanner.Err(); err != nil {
-		return nil, err
-	}
-	return meta, nil
-}
-
-func (r Repo) DockerCacheName(entry *manifest.Manifest2822Entry) (string, error) {
-	cacheHash, err := r.dockerCacheHash(entry)
-	if err != nil {
-		return "", err
-	}
-	return "bashbrew/cache:" + cacheHash, err
-}
-
-func (r Repo) dockerCacheHash(entry *manifest.Manifest2822Entry) (string, error) {
-	uniqueBits, err := r.dockerBuildUniqueBits(entry)
-	if err != nil {
-		return "", err
-	}
-	uniqueString := strings.Join(uniqueBits, "\n")
-	b := sha256.Sum256([]byte(uniqueString))
-	return hex.EncodeToString(b[:]), nil
-}
-
-func dockerInspect(format string, args ...string) (string, error) {
-	args = append([]string{"inspect", "-f", format}, args...)
-	out, err := exec.Command("docker", args...).Output()
-	if err != nil {
-		if ee, ok := err.(*exec.ExitError); ok {
-			return "", fmt.Errorf("%v\ncommand: docker inspect -f %q %q\n%s", ee, format, args, string(ee.Stderr))
-		}
-	}
-	return strings.TrimSpace(string(out)), nil
-}
-
-var dockerFromIdCache = map[string]string{
-	"scratch": "scratch",
-}
-
-func (r Repo) dockerBuildUniqueBits(entry *manifest.Manifest2822Entry) ([]string, error) {
-	uniqueBits := []string{
-		entry.ArchGitRepo(arch),
-		entry.ArchGitCommit(arch),
-		entry.ArchDirectory(arch),
-		entry.ArchFile(arch),
-	}
-	meta, err := r.dockerfileMetadata(entry)
-	if err != nil {
-		return nil, err
-	}
-	for _, from := range meta.Froms {
-		fromId, ok := dockerFromIdCache[from]
-		if !ok {
-			var err error
-			fromId, err = dockerInspect("{{.Id}}", from)
-			if err != nil {
-				return nil, err
-			}
-			dockerFromIdCache[from] = fromId
-		}
-		uniqueBits = append(uniqueBits, fromId)
-	}
-	return uniqueBits, nil
-}
-
-func dockerBuild(tag string, file string, context io.Reader) error {
-	args := []string{"build", "-t", tag, "-f", file, "--rm", "--force-rm"}
-	args = append(args, "-")
-	cmd := exec.Command("docker", args...)
-	cmd.Stdin = context
-	if debugFlag {
-		cmd.Stdout = os.Stdout
-		cmd.Stderr = os.Stderr
-		fmt.Printf("$ docker %q\n", args)
-		return cmd.Run()
-	} else {
-		buf := &bytes.Buffer{}
-		cmd.Stdout = buf
-		cmd.Stderr = buf
-		err := cmd.Run()
-		if err != nil {
-			err = cli.NewMultiError(err, fmt.Errorf(`docker %q output:%s`, args, "\n"+buf.String()))
-		}
-		return err
-	}
-}
-
-func dockerTag(tag1 string, tag2 string) error {
-	if debugFlag {
-		fmt.Printf("$ docker tag %q %q\n", tag1, tag2)
-	}
-	_, err := exec.Command("docker", "tag", tag1, tag2).Output()
-	if err != nil {
-		if ee, ok := err.(*exec.ExitError); ok {
-			return fmt.Errorf("%v\ncommand: docker tag %q %q\n%s", ee, tag1, tag2, string(ee.Stderr))
-		}
-	}
-	return err
-}
-
-func dockerPush(tag string) error {
-	if debugFlag {
-		fmt.Printf("$ docker push %q\n", tag)
-	}
-	_, err := exec.Command("docker", "push", tag).Output()
-	if err != nil {
-		if ee, ok := err.(*exec.ExitError); ok {
-			return fmt.Errorf("%v\ncommand: docker push %q\n%s", ee, tag, string(ee.Stderr))
-		}
-	}
-	return err
-}
-
-func dockerPull(tag string) error {
-	if debugFlag {
-		fmt.Printf("$ docker pull %q\n", tag)
-	}
-	_, err := exec.Command("docker", "pull", tag).Output()
-	if err != nil {
-		if ee, ok := err.(*exec.ExitError); ok {
-			return fmt.Errorf("%v\ncommand: docker pull %q\n%s", ee, tag, string(ee.Stderr))
-		}
-	}
-	return err
-}

+ 0 - 255
bashbrew/go/src/bashbrew/git.go

@@ -1,255 +0,0 @@
-package main
-
-import (
-	"fmt"
-	"io"
-	"io/ioutil"
-	"os"
-	"os/exec"
-	"path"
-	"path/filepath"
-	"regexp"
-	"strings"
-
-	"github.com/docker-library/go-dockerlibrary/manifest"
-	"github.com/docker-library/go-dockerlibrary/pkg/execpipe"
-
-	goGit "gopkg.in/src-d/go-git.v4"
-	goGitConfig "gopkg.in/src-d/go-git.v4/config"
-	goGitPlumbing "gopkg.in/src-d/go-git.v4/plumbing"
-)
-
-func gitCache() string {
-	return filepath.Join(defaultCache, "git")
-}
-
-func gitCommand(args ...string) *exec.Cmd {
-	if debugFlag {
-		fmt.Printf("$ git %q\n", args)
-	}
-	cmd := exec.Command("git", args...)
-	cmd.Dir = gitCache()
-	return cmd
-}
-
-func git(args ...string) ([]byte, error) {
-	out, err := gitCommand(args...).Output()
-	if err != nil {
-		if ee, ok := err.(*exec.ExitError); ok {
-			return nil, fmt.Errorf("%v\ncommand: git %q\n%s", ee, args, string(ee.Stderr))
-		}
-	}
-	return out, err
-}
-
-var gitRepo *goGit.Repository
-
-func ensureGitInit() error {
-	if gitRepo != nil {
-		return nil
-	}
-
-	gitCacheDir := gitCache()
-	err := os.MkdirAll(gitCacheDir, os.ModePerm)
-	if err != nil {
-		return err
-	}
-
-	gitRepo, err = goGit.PlainInit(gitCacheDir, true)
-	if err == goGit.ErrRepositoryAlreadyExists {
-		gitRepo, err = goGit.PlainOpen(gitCacheDir)
-	}
-	if err != nil {
-		return err
-	}
-
-	// ensure garbage collection is disabled so we keep dangling commits
-	config, err := gitRepo.Config()
-	if err != nil {
-		return err
-	}
-	config.Raw = config.Raw.SetOption("gc", "", "auto", "0")
-	gitRepo.Storer.SetConfig(config)
-
-	return nil
-}
-
-var fullGitCommitRegex = regexp.MustCompile(`^[0-9a-f]{40}$|^[0-9a-f]{64}$`)
-
-func getGitCommit(commit string) (string, error) {
-	if fullGitCommitRegex.MatchString(commit) {
-		_, err := gitRepo.CommitObject(goGitPlumbing.NewHash(commit))
-		if err != nil {
-			return "", err
-		}
-		return commit, nil
-	}
-
-	h, err := gitRepo.ResolveRevision(goGitPlumbing.Revision(commit + "^{commit}"))
-	if err != nil {
-		return "", err
-	}
-	return h.String(), nil
-}
-
-func gitStream(args ...string) (io.ReadCloser, error) {
-	return execpipe.Run(gitCommand(args...))
-}
-
-func gitArchive(commit string, dir string) (io.ReadCloser, error) {
-	if dir == "." {
-		dir = ""
-	} else {
-		dir += "/"
-	}
-	return gitStream("archive", "--format=tar", commit+":"+dir)
-}
-
-func gitShow(commit string, file string) (string, error) {
-	gitCommit, err := gitRepo.CommitObject(goGitPlumbing.NewHash(commit))
-	if err != nil {
-		return "", err
-	}
-
-	gitFile, err := gitCommit.File(file)
-	if err != nil {
-		return "", err
-	}
-
-	contents, err := gitFile.Contents()
-	if err != nil {
-		return "", err
-	}
-
-	return contents, nil
-}
-
-// for gitNormalizeForTagUsage()
-// see http://stackoverflow.com/a/26382358/433558
-var (
-	gitBadTagChars = regexp.MustCompile(`(?:` + strings.Join([]string{
-		`[^0-9a-zA-Z/._-]+`,
-
-		// They can include slash `/` for hierarchical (directory) grouping, but no slash-separated component can begin with a dot `.` or end with the sequence `.lock`.
-		`/[.]+`,
-		`[.]lock(?:/|$)`,
-
-		// They cannot have two consecutive dots `..` anywhere.
-		`[.][.]+`,
-
-		// They cannot end with a dot `.`
-		// They cannot begin or end with a slash `/`
-		`[/.]+$`,
-		`^[/.]+`,
-	}, `|`) + `)`)
-
-	gitMultipleSlashes = regexp.MustCompile(`(?://+)`)
-)
-
-// strip/replace "bad" characters from text for use as a Git tag
-func gitNormalizeForTagUsage(text string) string {
-	return gitMultipleSlashes.ReplaceAllString(gitBadTagChars.ReplaceAllString(text, "-"), "/")
-}
-
-var gitRepoCache = map[string]string{}
-
-func (r Repo) fetchGitRepo(arch string, entry *manifest.Manifest2822Entry) (string, error) {
-	cacheKey := strings.Join([]string{
-		entry.ArchGitRepo(arch),
-		entry.ArchGitFetch(arch),
-		entry.ArchGitCommit(arch),
-	}, "\n")
-	if commit, ok := gitRepoCache[cacheKey]; ok {
-		entry.SetGitCommit(arch, commit)
-		return commit, nil
-	}
-
-	err := ensureGitInit()
-	if err != nil {
-		return "", err
-	}
-
-	if manifest.GitCommitRegex.MatchString(entry.ArchGitCommit(arch)) {
-		commit, err := getGitCommit(entry.ArchGitCommit(arch))
-		if err == nil {
-			gitRepoCache[cacheKey] = commit
-			entry.SetGitCommit(arch, commit)
-			return commit, nil
-		}
-	}
-
-	fetchString := entry.ArchGitFetch(arch) + ":"
-	if entry.ArchGitCommit(arch) == "FETCH_HEAD" {
-		// fetch remote tag references to a local tag ref so that we can cache them and not re-fetch every time
-		localRef := "refs/tags/" + gitNormalizeForTagUsage(cacheKey)
-		commit, err := getGitCommit(localRef)
-		if err == nil {
-			gitRepoCache[cacheKey] = commit
-			entry.SetGitCommit(arch, commit)
-			return commit, nil
-		}
-		fetchString += localRef
-	} else {
-		// we create a temporary remote dir so that we can clean it up completely afterwards
-		refBase := "refs/remotes"
-		refBaseDir := filepath.Join(gitCache(), refBase)
-
-		err := os.MkdirAll(refBaseDir, os.ModePerm)
-		if err != nil {
-			return "", err
-		}
-
-		tempRefDir, err := ioutil.TempDir(refBaseDir, "temp")
-		if err != nil {
-			return "", err
-		}
-		defer os.RemoveAll(tempRefDir)
-
-		tempRef := path.Join(refBase, filepath.Base(tempRefDir))
-		if entry.ArchGitFetch(arch) == manifest.DefaultLineBasedFetch {
-			// backwards compat (see manifest/line-based.go in go-dockerlibrary)
-			fetchString += tempRef + "/*"
-		} else {
-			fetchString += tempRef + "/temp"
-		}
-	}
-
-	if strings.HasPrefix(entry.ArchGitRepo(arch), "git://github.com/") {
-		fmt.Fprintf(os.Stderr, "warning: insecure protocol git:// detected: %s\n", entry.ArchGitRepo(arch))
-		entry.SetGitRepo(arch, strings.Replace(entry.ArchGitRepo(arch), "git://", "https://", 1))
-	}
-
-	gitRemote, err := gitRepo.CreateRemoteAnonymous(&goGitConfig.RemoteConfig{
-		Name: "anonymous",
-		URLs: []string{entry.ArchGitRepo(arch)},
-	})
-	if err != nil {
-		return "", err
-	}
-
-	err = gitRemote.Fetch(&goGit.FetchOptions{
-		RefSpecs: []goGitConfig.RefSpec{goGitConfig.RefSpec(fetchString)},
-		Tags:     goGit.NoTags,
-
-		//Progress: os.Stdout,
-	})
-	if err != nil {
-		return "", err
-	}
-
-	commit, err := getGitCommit(entry.ArchGitCommit(arch))
-	if err != nil {
-		return "", err
-	}
-
-	gitTag := gitNormalizeForTagUsage(path.Join(arch, namespace, r.RepoName, entry.Tags[0]))
-	gitRepo.DeleteTag(gitTag) // avoid "ErrTagExists"
-	_, err = gitRepo.CreateTag(gitTag, goGitPlumbing.NewHash(commit), nil)
-	if err != nil {
-		return "", err
-	}
-
-	gitRepoCache[cacheKey] = commit
-	entry.SetGitCommit(arch, commit)
-	return commit, nil
-}

+ 0 - 63
bashbrew/go/src/bashbrew/hub.go

@@ -1,63 +0,0 @@
-package main
-
-import (
-	"encoding/json"
-	"fmt"
-	"net/http"
-	"os"
-	"strings"
-	"time"
-)
-
-type dockerHubTagMeta struct {
-	// we don't care what's in these -- we just need to be able to count them
-	Images []interface{} `json:"images"`
-
-	LastUpdated string `json:"last_updated"`
-}
-
-func (meta dockerHubTagMeta) lastUpdatedTime() time.Time {
-	t, err := time.Parse(time.RFC3339Nano, meta.LastUpdated)
-	if err != nil {
-		return time.Time{}
-	}
-	return t
-}
-
-func fetchDockerHubTagMeta(repoTag string) dockerHubTagMeta {
-	repoTag = latestizeRepoTag(repoTag)
-	parts := strings.SplitN(repoTag, ":", 2)
-	repo, tag := parts[0], parts[1]
-
-	var meta dockerHubTagMeta
-
-	resp, err := http.Get(fmt.Sprintf("https://hub.docker.com/v2/repositories/%s/tags/%s/", repo, tag))
-	if err != nil {
-		return meta
-	}
-	defer resp.Body.Close()
-
-	err = json.NewDecoder(resp.Body).Decode(&meta)
-	if err != nil {
-		return meta
-	}
-
-	return meta
-}
-
-func dockerCreated(image string) time.Time {
-	created, err := dockerInspect("{{.Created}}", image)
-	if err != nil {
-		fmt.Fprintf(os.Stderr, "warning: error while fetching creation time of %q: %v\n", image, err)
-		return time.Now()
-	}
-	created = strings.TrimSpace(created)
-
-	t, err := time.Parse(time.RFC3339Nano, created)
-	if err != nil {
-		fmt.Fprintf(os.Stderr, "warning: error while parsing creation time of %q (%q): %v\n", image, created, err)
-		return time.Now()
-	}
-
-	return t
-}

+ 0 - 378
bashbrew/go/src/bashbrew/main.go

@@ -1,378 +0,0 @@
-package main
-
-import (
-	"fmt"
-	"os"
-	"path/filepath"
-	"strings"
-
-	"github.com/codegangsta/cli"
-
-	"github.com/docker-library/go-dockerlibrary/manifest"
-)
-
-// TODO somewhere, ensure that the Docker engine we're talking to is API version 1.22+ (Docker 1.10+)
-//   docker version --format '{{.Server.APIVersion}}'
-
-var (
-	configPath  string
-	flagsConfig *FlagsConfig
-
-	defaultLibrary string
-	defaultCache   string
-
-	arch                 string
-	namespace            string
-	constraints          []string
-	exclusiveConstraints bool
-
-	archNamespaces map[string]string
-
-	debugFlag  = false
-	noSortFlag = false
-
-	// separated so that FlagsConfig.ApplyTo can access them
-	flagEnvVars = map[string]string{
-		"debug":     "BASHBREW_DEBUG",
-		"arch":      "BASHBREW_ARCH",
-		"namespace": "BASHBREW_NAMESPACE",
-		"config":    "BASHBREW_CONFIG",
-		"library":   "BASHBREW_LIBRARY",
-		"cache":     "BASHBREW_CACHE",
-		"pull":      "BASHBREW_PULL",
-
-		"constraint":     "BASHBREW_CONSTRAINTS",
-		"arch-namespace": "BASHBREW_ARCH_NAMESPACES",
-	}
-)
-
-func initDefaultConfigPath() string {
-	xdgConfig := os.Getenv("XDG_CONFIG_HOME")
-	if xdgConfig == "" {
-		xdgConfig = filepath.Join(os.Getenv("HOME"), ".config")
-	}
-	return filepath.Join(xdgConfig, "bashbrew")
-}
-
-func initDefaultCachePath() string {
-	xdgCache := os.Getenv("XDG_CACHE_HOME")
-	if xdgCache == "" {
-		xdgCache = filepath.Join(os.Getenv("HOME"), ".cache")
-	}
-	return filepath.Join(xdgCache, "bashbrew")
-}
-
-func main() {
-	app := cli.NewApp()
-	app.Name = "bashbrew"
-	app.Usage = "canonical build tool for the official images"
-	app.Version = "dev"
-	app.HideVersion = true
-	app.EnableBashCompletion = true
-
-	// TODO add "Description" to app and commands (for longer-form description of their functionality)
-
-	// add "-?" to HelpFlag
-	cli.HelpFlag = cli.BoolFlag{
-		Name:  "help, h, ?",
-		Usage: "show help",
-	}
-
-	app.Flags = []cli.Flag{
-		cli.BoolFlag{
-			Name:   "debug",
-			EnvVar: flagEnvVars["debug"],
-			Usage:  `enable more output (esp. all "docker build" output instead of only output on failure)`,
-		},
-		cli.BoolFlag{
-			Name:  "no-sort",
-			Usage: "do not apply any sorting, even via --build-order",
-		},
-
-		cli.StringFlag{
-			Name:   "arch",
-			Value:  manifest.DefaultArchitecture,
-			EnvVar: flagEnvVars["arch"],
-			Usage:  "the current platform architecture",
-		},
-		cli.StringFlag{
-			Name:   "namespace",
-			EnvVar: flagEnvVars["namespace"],
-			Usage:  "a repo namespace to act upon/in",
-		},
-		cli.StringSliceFlag{
-			Name:   "constraint",
-			EnvVar: flagEnvVars["constraint"],
-			Usage:  "build constraints (see Constraints in Manifest2822Entry)",
-		},
-		cli.BoolFlag{
-			Name:  "exclusive-constraints",
-			Usage: "skip entries which do not have Constraints",
-		},
-
-		cli.StringSliceFlag{
-			Name:   "arch-namespace",
-			EnvVar: flagEnvVars["arch-namespace"],
-			Usage:  `architecture to push namespace mappings for creating indexes/manifest lists ("arch=namespace" ala "s390x=tianons390x")`,
-		},
-
-		cli.StringFlag{
-			Name:   "config",
-			Value:  initDefaultConfigPath(),
-			EnvVar: flagEnvVars["config"],
-			Usage:  `where default "flags" configuration can be overridden more persistently`,
-		},
-		cli.StringFlag{
-			Name:   "library",
-			Value:  filepath.Join(os.Getenv("HOME"), "docker", "official-images", "library"),
-			EnvVar: flagEnvVars["library"],
-			Usage:  "where the bodies are buried",
-		},
-		cli.StringFlag{
-			Name:   "cache",
-			Value:  initDefaultCachePath(),
-			EnvVar: flagEnvVars["cache"],
-			Usage:  "where the git wizardry is stashed",
-		},
-	}
-
-	app.Before = func(c *cli.Context) error {
-		var err error
-
-		configPath, err = filepath.Abs(c.String("config"))
-		if err != nil {
-			return err
-		}
-
-		flagsConfig, err = ParseFlagsConfigFile(filepath.Join(configPath, "flags"))
-		if err != nil && !os.IsNotExist(err) {
-			return err
-		}
-
-		return nil
-	}
-
-	subcommandBeforeFactory := func(cmd string) cli.BeforeFunc {
-		return func(c *cli.Context) error {
-			err := flagsConfig.ApplyTo(cmd, c)
-			if err != nil {
-				return err
-			}
-
-			debugFlag = c.GlobalBool("debug")
-			noSortFlag = c.GlobalBool("no-sort")
-
-			arch = c.GlobalString("arch")
-			namespace = c.GlobalString("namespace")
-			constraints = c.GlobalStringSlice("constraint")
-			exclusiveConstraints = c.GlobalBool("exclusive-constraints")
-
-			archNamespaces = map[string]string{}
-			for _, archMapping := range c.GlobalStringSlice("arch-namespace") {
-				splitArchMapping := strings.SplitN(archMapping, "=", 2)
-				splitArch, splitNamespace := strings.TrimSpace(splitArchMapping[0]), strings.TrimSpace(splitArchMapping[1])
-				archNamespaces[splitArch] = splitNamespace
-			}
-
-			defaultLibrary, err = filepath.Abs(c.GlobalString("library"))
-			if err != nil {
-				return err
-			}
-			defaultCache, err = filepath.Abs(c.GlobalString("cache"))
-			if err != nil {
-				return err
-			}
-
-			return nil
-		}
-	}
-
-	// define a few useful flags so their usage, etc can be consistent
-	commonFlags := map[string]cli.Flag{
-		"all": cli.BoolFlag{
-			Name:  "all",
-			Usage: "act upon all repos listed in --library",
-		},
-		"uniq": cli.BoolFlag{
-			Name:  "uniq, unique",
-			Usage: "only act upon the first tag of each entry",
-		},
-		"apply-constraints": cli.BoolFlag{
-			Name:  "apply-constraints",
-			Usage: "apply Constraints as if repos were building",
-		},
-		"depth": cli.IntFlag{
-			Name:  "depth",
-			Value: 0,
-			Usage: "maximum number of levels to traverse (0 for unlimited)",
-		},
-		"dry-run": cli.BoolFlag{
-			Name:  "dry-run",
-			Usage: "do everything except the final action (for testing whether actions will be performed)",
-		},
-		"force": cli.BoolFlag{
-			Name:  "force",
-			Usage: "always push (skip the clever Hub API lookups that no-op things sooner if a push doesn't seem necessary)",
-		},
-		"target-namespace": cli.StringFlag{
-			Name:  "target-namespace",
-			Usage: `target namespace to act into ("docker tag namespace/repo:tag target-namespace/repo:tag", "docker push target-namespace/repo:tag")`,
-		},
-	}
-
-	app.Commands = []cli.Command{
-		{
-			Name:    "list",
-			Aliases: []string{"ls"},
-			Usage:   "list repo:tag combinations for a given repo",
-			Flags: []cli.Flag{
-				commonFlags["all"],
-				commonFlags["uniq"],
-				commonFlags["apply-constraints"],
-				cli.BoolFlag{
-					Name:  "build-order",
-					Usage: "sort by the order repos would need to build (topsort)",
-				},
-				cli.BoolFlag{
-					Name:  "repos",
-					Usage: `list only repos, not repo:tag (unless "repo:tag" is explicitly specified)`,
-				},
-			},
-			Before: subcommandBeforeFactory("list"),
-			Action: cmdList,
-		},
-		{
-			Name:  "build",
-			Usage: "build (and tag) repo:tag combinations for a given repo",
-			Flags: []cli.Flag{
-				commonFlags["all"],
-				commonFlags["uniq"],
-				cli.StringFlag{
-					Name:   "pull",
-					Value:  "missing",
-					EnvVar: flagEnvVars["pull"],
-					Usage:  `pull FROM before building (always, missing, never)`,
-				},
-				commonFlags["dry-run"],
-			},
-			Before: subcommandBeforeFactory("build"),
-			Action: cmdBuild,
-		},
-		{
-			Name:  "tag",
-			Usage: "tag repo:tag into a namespace (especially for pushing)",
-			Flags: []cli.Flag{
-				commonFlags["all"],
-				commonFlags["uniq"],
-				commonFlags["dry-run"],
-				commonFlags["target-namespace"],
-			},
-			Before: subcommandBeforeFactory("tag"),
-			Action: cmdTag,
-		},
-		{
-			Name:  "push",
-			Usage: `push namespace/repo:tag (see also "tag")`,
-			Flags: []cli.Flag{
-				commonFlags["all"],
-				commonFlags["uniq"],
-				commonFlags["dry-run"],
-				commonFlags["force"],
-				commonFlags["target-namespace"],
-			},
-			Before: subcommandBeforeFactory("push"),
-			Action: cmdPush,
-		},
-		{
-			Name:  "put-shared",
-			Usage: `update shared tags in the registry (and multi-architecture tags)`,
-			Flags: []cli.Flag{
-				commonFlags["all"],
-				commonFlags["dry-run"],
-				commonFlags["force"],
-				commonFlags["target-namespace"],
-				cli.BoolFlag{
-					Name:  "single-arch",
-					Usage: `only act on the current architecture (for pushing "amd64/hello-world:latest", for example)`,
-				},
-			},
-			Before: subcommandBeforeFactory("put-shared"),
-			Action: cmdPutShared,
-		},
-
-		{
-			Name: "children",
-			Aliases: []string{
-				"offspring",
-				"descendants",
-				"progeny",
-			},
-			Usage: `print the repos built FROM a given repo or repo:tag`,
-			Flags: []cli.Flag{
-				commonFlags["apply-constraints"],
-				commonFlags["depth"],
-			},
-			Before: subcommandBeforeFactory("children"),
-			Action: cmdOffspring,
-
-			Category: "plumbing",
-		},
-		{
-			Name: "parents",
-			Aliases: []string{
-				"ancestors",
-				"progenitors",
-			},
-			Usage: `print the repos this repo or repo:tag is FROM`,
-			Flags: []cli.Flag{
-				commonFlags["apply-constraints"],
-				commonFlags["depth"],
-			},
-			Before: subcommandBeforeFactory("parents"),
-			Action: cmdParents,
-
-			Category: "plumbing",
-		},
-		{
-			Name:  "cat",
-			Usage: "print manifest contents for repo or repo:tag",
-			Flags: []cli.Flag{
-				commonFlags["all"],
-				cli.StringFlag{
-					Name:  "format, f",
-					Usage: "change the `FORMAT` of the output",
-					Value: DefaultCatFormat,
-				},
-				cli.StringFlag{
-					Name:  "format-file, F",
-					Usage: "use the contents of `FILE` for \"--format\"",
-				},
-			},
-			Before: subcommandBeforeFactory("cat"),
-			Action: cmdCat,
-
-			Description: `see Go's "text/template" package (https://golang.org/pkg/text/template/) for details on the syntax expected in "--format"`,
-
-			Category: "plumbing",
-		},
-		{
-			Name:  "from",
-			Usage: "print FROM for repo:tag",
-			Flags: []cli.Flag{
-				commonFlags["all"],
-				commonFlags["uniq"],
-				commonFlags["apply-constraints"],
-			},
-			Before: subcommandBeforeFactory("from"),
-			Action: cmdFrom,
-
-			Category: "plumbing",
-		},
-	}
-
-	err := app.Run(os.Args)
-	if err != nil {
-		fmt.Fprintf(os.Stderr, "error: %v\n", err)
-		os.Exit(1)
-	}
-}

+ 0 - 36
bashbrew/go/src/bashbrew/manifest-tool.go

@@ -1,36 +0,0 @@
-package main
-
-import (
-	"fmt"
-	"io/ioutil"
-	"os"
-	"os/exec"
-)
-
-func manifestToolPushFromSpec(yamlSpec string) error {
-	yamlFile, err := ioutil.TempFile("", "bashbrew-manifest-tool-yaml-")
-	if err != nil {
-		return err
-	}
-	defer os.Remove(yamlFile.Name())
-
-	if _, err := yamlFile.Write([]byte(yamlSpec)); err != nil {
-		return err
-	}
-	if err := yamlFile.Close(); err != nil {
-		return err
-	}
-
-	args := []string{"push", "from-spec", "--ignore-missing", yamlFile.Name()}
-	if debugFlag {
-		args = append([]string{"--debug"}, args...)
-		fmt.Printf("$ manifest-tool %q\n", args)
-	}
-	cmd := exec.Command("manifest-tool", args...)
-	cmd.Stderr = os.Stderr
-	if debugFlag {
-		cmd.Stdout = os.Stdout
-	}
-
-	return cmd.Run()
-}

+ 0 - 198
bashbrew/go/src/bashbrew/repo.go

@@ -1,198 +0,0 @@
-package main
-
-import (
-	"fmt"
-	"os"
-	"path"
-	"path/filepath"
-	"sort"
-	"strings"
-
-	"github.com/docker-library/go-dockerlibrary/manifest"
-)
-
-func repos(all bool, args ...string) ([]string, error) {
-	ret := []string{}
-
-	if all {
-		dir, err := os.Open(defaultLibrary)
-		if err != nil {
-			return nil, err
-		}
-		names, err := dir.Readdirnames(-1)
-		dir.Close()
-		if err != nil {
-			return nil, err
-		}
-		sort.Strings(names)
-		for _, name := range names {
-			ret = append(ret, filepath.Join(defaultLibrary, name))
-		}
-	}
-
-	ret = append(ret, args...)
-
-	if len(ret) < 1 {
-		return nil, fmt.Errorf(`need at least one repo (either explicitly or via "--all")`)
-	}
-
-	return ret, nil
-}
-
-func latestizeRepoTag(repoTag string) string {
-	if repoTag != "scratch" && strings.IndexRune(repoTag, ':') < 0 {
-		return repoTag + ":latest"
-	}
-	return repoTag
-}
-
-type Repo struct {
-	RepoName string
-	TagName  string
-	Manifest *manifest.Manifest2822
-	TagEntry *manifest.Manifest2822Entry
-
-	// if "TagName" refers to a SharedTag, "TagEntry" will be the first match, this will contain all matches (otherwise it will be just "TagEntry")
-	TagEntries []*manifest.Manifest2822Entry
-}
-
-func (r Repo) Identifier() string {
-	if r.TagEntry != nil {
-		return r.EntryIdentifier(r.TagEntry)
-	}
-	return r.RepoName
-}
-
-func (r Repo) EntryIdentifier(entry *manifest.Manifest2822Entry) string {
-	return r.RepoName + ":" + entry.Tags[0]
-}
-
-// create a new "Repo" object representing a single "Manifest2822Entry" object
-func (r Repo) EntryRepo(entry *manifest.Manifest2822Entry) *Repo {
-	return &Repo{
-		RepoName:   r.RepoName,
-		TagName:    entry.Tags[0],
-		Manifest:   r.Manifest,
-		TagEntry:   entry,
-		TagEntries: []*manifest.Manifest2822Entry{entry},
-	}
-}
-
-var haveOutputSkippedMessage = map[string]bool{}
-
-func (r Repo) SkipConstraints(entry *manifest.Manifest2822Entry) bool {
-	repoTag := r.RepoName + ":" + entry.Tags[0]
-
-	// TODO decide if "arch" and "constraints" should be handled separately (but probably not)
-	if !entry.HasArchitecture(arch) {
-		if !haveOutputSkippedMessage[repoTag] {
-			fmt.Fprintf(os.Stderr, "skipping %q (due to architecture %q; only %q supported)\n", repoTag, arch, entry.ArchitecturesString())
-			haveOutputSkippedMessage[repoTag] = true
-		}
-		return true
-	}
-
-	if len(entry.Constraints) == 0 {
-		if exclusiveConstraints {
-			if !haveOutputSkippedMessage[repoTag] {
-				fmt.Fprintf(os.Stderr, "skipping %q (due to exclusive constraints)\n", repoTag)
-				haveOutputSkippedMessage[repoTag] = true
-			}
-		}
-		return exclusiveConstraints
-	}
-
-	unsatisfactory := []string{}
-
-NextConstraint:
-	for _, eConstraint := range entry.Constraints {
-		wanted := true
-		if eConstraint[0] == '!' {
-			wanted = false
-			eConstraint = eConstraint[1:]
-		}
-
-		for _, gConstraint := range constraints {
-			if gConstraint == eConstraint {
-				// if we did not want "aufs" ("!aufs") but found it, UNSATISFACTORY
-				if !wanted {
-					unsatisfactory = append(unsatisfactory, eConstraint)
-				}
-				continue NextConstraint
-			}
-		}
-
-		// if we want "aufs" but did not find it, UNSATISFACTORY
-		if wanted {
-			unsatisfactory = append(unsatisfactory, eConstraint)
-		}
-	}
-
-	if len(unsatisfactory) > 0 {
-		if !haveOutputSkippedMessage[repoTag] {
-			fmt.Fprintf(os.Stderr, "skipping %q (due to unsatisfactory constraints %q)\n", repoTag, unsatisfactory)
-			haveOutputSkippedMessage[repoTag] = true
-		}
-		return true
-	}
-
-	return false
-}
-
-func (r Repo) Entries() []*manifest.Manifest2822Entry {
-	if r.TagName == "" {
-		ret := []*manifest.Manifest2822Entry{}
-		for i := range r.Manifest.Entries {
-			ret = append(ret, &r.Manifest.Entries[i])
-		}
-		return ret
-	} else {
-		return r.TagEntries
-	}
-}
-
-func (r Repo) Tags(namespace string, uniq bool, entry *manifest.Manifest2822Entry) []string {
-	tagRepo := path.Join(namespace, r.RepoName)
-	ret := []string{}
-	tags := append([]string{}, entry.Tags...)
-	tags = append(tags, entry.SharedTags...)
-	for i, tag := range tags {
-		if uniq && i > 0 {
-			break
-		}
-		ret = append(ret, tagRepo+":"+tag)
-	}
-	return ret
-}
-
-var repoCache = map[string]*Repo{}
-
-func fetch(repo string) (*Repo, error) {
-	if r, ok := repoCache[repo]; ok {
-		return r, nil
-	}
-
-	repoName, tagName, man, err := manifest.Fetch(defaultLibrary, repo)
-	if err != nil {
-		return nil, err
-	}
-
-	r := &Repo{
-		RepoName: repoName,
-		TagName:  tagName,
-		Manifest: man,
-	}
-	if tagName != "" {
-		r.TagEntry = man.GetTag(tagName)
-		if r.TagEntry == nil {
-			// must be a SharedTag
-			r.TagEntries = man.GetSharedTag(tagName)
-			r.TagEntry = r.TagEntries[0]
-		} else {
-			// not a SharedTag, backfill TagEntries
-			r.TagEntries = []*manifest.Manifest2822Entry{r.TagEntry}
-		}
-	}
-	repoCache[repo] = r
-	return r, nil
-}

+ 0 - 148
bashbrew/go/src/bashbrew/sort.go

@@ -1,148 +0,0 @@
-package main
-
-import (
-	"github.com/docker-library/go-dockerlibrary/manifest"
-	"pault.ag/go/topsort"
-)
-
-func sortRepos(repos []string, applyConstraints bool) ([]string, error) {
-	rs := []*Repo{}
-	rsMap := map[*Repo]string{}
-	for _, repo := range repos {
-		r, err := fetch(repo)
-		if err != nil {
-			return nil, err
-		}
-		if _, ok := rsMap[r]; ok {
-			// if we have a duplicate, let's prefer the first
-			continue
-		}
-		rs = append(rs, r)
-		rsMap[r] = repo
-	}
-
-	// short circuit if we don't have to go further
-	if noSortFlag || len(repos) <= 1 {
-		return repos, nil
-	}
-
-	rs, err := sortRepoObjects(rs, applyConstraints)
-	if err != nil {
-		return nil, err
-	}
-
-	ret := []string{}
-	for _, r := range rs {
-		ret = append(ret, rsMap[r])
-	}
-	return ret, nil
-}
-
-func (r Repo) SortedEntries(applyConstraints bool) ([]*manifest.Manifest2822Entry, error) {
-	entries := r.Entries()
-
-	// short circuit if we don't have to go further
-	if noSortFlag || len(entries) <= 1 {
-		return entries, nil
-	}
-
-	// create individual "Repo" objects for each entry in "r" so they can be sorted by the same "sortRepoObjects" function
-	rs := []*Repo{}
-	for i := range entries {
-		rs = append(rs, r.EntryRepo(entries[i]))
-	}
-
-	rs, err := sortRepoObjects(rs, applyConstraints)
-	if err != nil {
-		return nil, err
-	}
-
-	ret := []*manifest.Manifest2822Entry{}
-	for _, entryR := range rs {
-		ret = append(ret, entryR.TagEntries...)
-	}
-	return ret, nil
-}
-
-func sortRepoObjects(rs []*Repo, applyConstraints bool) ([]*Repo, error) {
-	// short circuit if we don't have to go further
-	if noSortFlag || len(rs) <= 1 {
-		return rs, nil
-	}
-
-	network := topsort.NewNetwork()
-
-	// a map of alternate tag names to the canonical "node name" for topsort purposes
-	canonicalNodes := map[string]string{}
-	canonicalRepos := map[string]*Repo{}
-
-	for _, r := range rs {
-		node := r.Identifier()
-		for _, entry := range r.Entries() {
-			// add edges both with and without namespace so sorting still works properly for official images ("bashbrew --namespace amd64 list --build-order wordpress php")
-			// this should be reasonably harmless for other use cases of --namespace but catches things like "tianon/foo -> tianon/bar" and things like "php -> wordpress" equally even if we're building to target a different namespace
-			tags := []string{}
-			tags = append(tags, r.Tags("", false, entry)...)
-			tags = append(tags, r.Tags(namespace, false, entry)...)
-			for _, tag := range tags {
-				if canonicalRepo, ok := canonicalRepos[tag]; ok && canonicalRepo.TagName != "" {
-					// if we run into a duplicate, we want to prefer a specific tag over a full repo
-					continue
-				}
-
-				canonicalNodes[tag] = node
-				canonicalRepos[tag] = r
-			}
-		}
-		network.AddNode(node, r)
-	}
-
-	for _, r := range rs {
-		for _, entry := range r.Entries() {
-			if applyConstraints && r.SkipConstraints(entry) {
-				continue
-			}
-			if !entry.HasArchitecture(arch) {
-				continue
-			}
-
-			froms, err := r.DockerFroms(entry)
-			if err != nil {
-				return nil, err
-			}
-
-			for _, from := range froms {
-				fromNode, ok := canonicalNodes[from]
-				if !ok {
-					// if our FROM isn't in the list of things we're sorting, it isn't relevant in this context
-					continue
-				}
-
-				// TODO somehow reconcile/avoid "a:a -> b:b, b:b -> a:c" (which will exhibit here as cyclic)
-				for _, tag := range r.Tags(namespace, false, entry) {
-					if tagNode, ok := canonicalNodes[tag]; ok {
-						if tagNode == fromNode {
-							// don't be cyclic
-							continue
-						}
-						if err := network.AddEdge(fromNode, tagNode); err != nil {
-							return nil, err
-						}
-					}
-				}
-			}
-		}
-	}
-
-	nodes, err := network.Sort()
-	if err != nil {
-		return nil, err
-	}
-
-	ret := []*Repo{}
-	for _, node := range nodes {
-		ret = append(ret, node.Value.(*Repo))
-	}
-
-	return ret, nil
-}

+ 0 - 2
bashbrew/go/vendor/github.com/codegangsta/cli/.flake8

@@ -1,2 +0,0 @@
-[flake8]
-max-line-length = 120

+ 0 - 2
bashbrew/go/vendor/github.com/codegangsta/cli/.gitignore

@@ -1,2 +0,0 @@
-*.coverprofile
-node_modules/

+ 0 - 27
bashbrew/go/vendor/github.com/codegangsta/cli/.travis.yml

@@ -1,27 +0,0 @@
-language: go
-sudo: false
-dist: trusty
-osx_image: xcode8.3
-go: 1.8.x
-
-os:
-- linux
-- osx
-
-cache:
-  directories:
-  - node_modules
-
-before_script:
-- go get github.com/urfave/gfmrun/... || true
-- go get golang.org/x/tools/cmd/goimports
-- if [ ! -f node_modules/.bin/markdown-toc ] ; then
-    npm install markdown-toc ;
-  fi
-
-script:
-- ./runtests gen
-- ./runtests vet
-- ./runtests test
-- ./runtests gfmrun
-- ./runtests toc

+ 0 - 435
bashbrew/go/vendor/github.com/codegangsta/cli/CHANGELOG.md

@@ -1,435 +0,0 @@
-# Change Log
-
-**ATTN**: This project uses [semantic versioning](http://semver.org/).
-
-## [Unreleased]
-
-## 1.20.0 - 2017-08-10
-
-### Fixed
-
-* `HandleExitCoder` is now correctly iterates over all errors in
-  a `MultiError`. The exit code is the exit code of the last error or `1` if
-  there are no `ExitCoder`s in the `MultiError`.
-* Fixed YAML file loading on Windows (previously would fail validate the file path)
-* Subcommand `Usage`, `Description`, `ArgsUsage`, `OnUsageError` correctly
-  propogated
-* `ErrWriter` is now passed downwards through command structure to avoid the
-  need to redefine it
-* Pass `Command` context into `OnUsageError` rather than parent context so that
-  all fields are avaiable
-* Errors occuring in `Before` funcs are no longer double printed
-* Use `UsageText` in the help templates for commands and subcommands if
-  defined; otherwise build the usage as before (was previously ignoring this
-  field)
-* `IsSet` and `GlobalIsSet` now correctly return whether a flag is set if
-  a program calls `Set` or `GlobalSet` directly after flag parsing (would
-  previously only return `true` if the flag was set during parsing)
-
-### Changed
-
-* No longer exit the program on command/subcommand error if the error raised is
-  not an `OsExiter`. This exiting behavior was introduced in 1.19.0, but was
-  determined to be a regression in functionality. See [the
-  PR](https://github.com/urfave/cli/pull/595) for discussion.
-
-### Added
-
-* `CommandsByName` type was added to make it easy to sort `Command`s by name,
-  alphabetically
-* `altsrc` now handles loading of string and int arrays from TOML
-* Support for definition of custom help templates for `App` via
-  `CustomAppHelpTemplate`
-* Support for arbitrary key/value fields on `App` to be used with
-  `CustomAppHelpTemplate` via `ExtraInfo`
-* `HelpFlag`, `VersionFlag`, and `BashCompletionFlag` changed to explictly be
-  `cli.Flag`s allowing for the use of custom flags satisfying the `cli.Flag`
-  interface to be used.
-
-
-## [1.19.1] - 2016-11-21
-
-### Fixed
-
-- Fixes regression introduced in 1.19.0 where using an `ActionFunc` as
-  the `Action` for a command would cause it to error rather than calling the
-  function. Should not have a affected declarative cases using `func(c
-  *cli.Context) err)`.
-- Shell completion now handles the case where the user specifies
-  `--generate-bash-completion` immediately after a flag that takes an argument.
-  Previously it call the application with `--generate-bash-completion` as the
-  flag value.
-
-## [1.19.0] - 2016-11-19
-### Added
-- `FlagsByName` was added to make it easy to sort flags (e.g. `sort.Sort(cli.FlagsByName(app.Flags))`)
-- A `Description` field was added to `App` for a more detailed description of
-  the application (similar to the existing `Description` field on `Command`)
-- Flag type code generation via `go generate`
-- Write to stderr and exit 1 if action returns non-nil error
-- Added support for TOML to the `altsrc` loader
-- `SkipArgReorder` was added to allow users to skip the argument reordering.
-  This is useful if you want to consider all "flags" after an argument as
-  arguments rather than flags (the default behavior of the stdlib `flag`
-  library). This is backported functionality from the [removal of the flag
-  reordering](https://github.com/urfave/cli/pull/398) in the unreleased version
-  2
-- For formatted errors (those implementing `ErrorFormatter`), the errors will
-  be formatted during output. Compatible with `pkg/errors`.
-
-### Changed
-- Raise minimum tested/supported Go version to 1.2+
-
-### Fixed
-- Consider empty environment variables as set (previously environment variables
-  with the equivalent of `""` would be skipped rather than their value used).
-- Return an error if the value in a given environment variable cannot be parsed
-  as the flag type. Previously these errors were silently swallowed.
-- Print full error when an invalid flag is specified (which includes the invalid flag)
-- `App.Writer` defaults to `stdout` when `nil`
-- If no action is specified on a command or app, the help is now printed instead of `panic`ing
-- `App.Metadata` is initialized automatically now (previously was `nil` unless initialized)
-- Correctly show help message if `-h` is provided to a subcommand
-- `context.(Global)IsSet` now respects environment variables. Previously it
-  would return `false` if a flag was specified in the environment rather than
-  as an argument
-- Removed deprecation warnings to STDERR to avoid them leaking to the end-user
-- `altsrc`s import paths were updated to use `gopkg.in/urfave/cli.v1`. This
-  fixes issues that occurred when `gopkg.in/urfave/cli.v1` was imported as well
-  as `altsrc` where Go would complain that the types didn't match
-
-## [1.18.1] - 2016-08-28
-### Fixed
-- Removed deprecation warnings to STDERR to avoid them leaking to the end-user (backported)
-
-## [1.18.0] - 2016-06-27
-### Added
-- `./runtests` test runner with coverage tracking by default
-- testing on OS X
-- testing on Windows
-- `UintFlag`, `Uint64Flag`, and `Int64Flag` types and supporting code
-
-### Changed
-- Use spaces for alignment in help/usage output instead of tabs, making the
-  output alignment consistent regardless of tab width
-
-### Fixed
-- Printing of command aliases in help text
-- Printing of visible flags for both struct and struct pointer flags
-- Display the `help` subcommand when using `CommandCategories`
-- No longer swallows `panic`s that occur within the `Action`s themselves when
-  detecting the signature of the `Action` field
-
-## [1.17.1] - 2016-08-28
-### Fixed
-- Removed deprecation warnings to STDERR to avoid them leaking to the end-user
-
-## [1.17.0] - 2016-05-09
-### Added
-- Pluggable flag-level help text rendering via `cli.DefaultFlagStringFunc`
-- `context.GlobalBoolT` was added as an analogue to `context.GlobalBool`
-- Support for hiding commands by setting `Hidden: true` -- this will hide the
-  commands in help output
-
-### Changed
-- `Float64Flag`, `IntFlag`, and `DurationFlag` default values are no longer
-  quoted in help text output.
-- All flag types now include `(default: {value})` strings following usage when a
-  default value can be (reasonably) detected.
-- `IntSliceFlag` and `StringSliceFlag` usage strings are now more consistent
-  with non-slice flag types
-- Apps now exit with a code of 3 if an unknown subcommand is specified
-  (previously they printed "No help topic for...", but still exited 0. This
-  makes it easier to script around apps built using `cli` since they can trust
-  that a 0 exit code indicated a successful execution.
-- cleanups based on [Go Report Card
-  feedback](https://goreportcard.com/report/github.com/urfave/cli)
-
-## [1.16.1] - 2016-08-28
-### Fixed
-- Removed deprecation warnings to STDERR to avoid them leaking to the end-user
-
-## [1.16.0] - 2016-05-02
-### Added
-- `Hidden` field on all flag struct types to omit from generated help text
-
-### Changed
-- `BashCompletionFlag` (`--enable-bash-completion`) is now omitted from
-generated help text via the `Hidden` field
-
-### Fixed
-- handling of error values in `HandleAction` and `HandleExitCoder`
-
-## [1.15.0] - 2016-04-30
-### Added
-- This file!
-- Support for placeholders in flag usage strings
-- `App.Metadata` map for arbitrary data/state management
-- `Set` and `GlobalSet` methods on `*cli.Context` for altering values after
-parsing.
-- Support for nested lookup of dot-delimited keys in structures loaded from
-YAML.
-
-### Changed
-- The `App.Action` and `Command.Action` now prefer a return signature of
-`func(*cli.Context) error`, as defined by `cli.ActionFunc`.  If a non-nil
-`error` is returned, there may be two outcomes:
-    - If the error fulfills `cli.ExitCoder`, then `os.Exit` will be called
-    automatically
-    - Else the error is bubbled up and returned from `App.Run`
-- Specifying an `Action` with the legacy return signature of
-`func(*cli.Context)` will produce a deprecation message to stderr
-- Specifying an `Action` that is not a `func` type will produce a non-zero exit
-from `App.Run`
-- Specifying an `Action` func that has an invalid (input) signature will
-produce a non-zero exit from `App.Run`
-
-### Deprecated
-- <a name="deprecated-cli-app-runandexitonerror"></a>
-`cli.App.RunAndExitOnError`, which should now be done by returning an error
-that fulfills `cli.ExitCoder` to `cli.App.Run`.
-- <a name="deprecated-cli-app-action-signature"></a> the legacy signature for
-`cli.App.Action` of `func(*cli.Context)`, which should now have a return
-signature of `func(*cli.Context) error`, as defined by `cli.ActionFunc`.
-
-### Fixed
-- Added missing `*cli.Context.GlobalFloat64` method
-
-## [1.14.0] - 2016-04-03 (backfilled 2016-04-25)
-### Added
-- Codebeat badge
-- Support for categorization via `CategorizedHelp` and `Categories` on app.
-
-### Changed
-- Use `filepath.Base` instead of `path.Base` in `Name` and `HelpName`.
-
-### Fixed
-- Ensure version is not shown in help text when `HideVersion` set.
-
-## [1.13.0] - 2016-03-06 (backfilled 2016-04-25)
-### Added
-- YAML file input support.
-- `NArg` method on context.
-
-## [1.12.0] - 2016-02-17 (backfilled 2016-04-25)
-### Added
-- Custom usage error handling.
-- Custom text support in `USAGE` section of help output.
-- Improved help messages for empty strings.
-- AppVeyor CI configuration.
-
-### Changed
-- Removed `panic` from default help printer func.
-- De-duping and optimizations.
-
-### Fixed
-- Correctly handle `Before`/`After` at command level when no subcommands.
-- Case of literal `-` argument causing flag reordering.
-- Environment variable hints on Windows.
-- Docs updates.
-
-## [1.11.1] - 2015-12-21 (backfilled 2016-04-25)
-### Changed
-- Use `path.Base` in `Name` and `HelpName`
-- Export `GetName` on flag types.
-
-### Fixed
-- Flag parsing when skipping is enabled.
-- Test output cleanup.
-- Move completion check to account for empty input case.
-
-## [1.11.0] - 2015-11-15 (backfilled 2016-04-25)
-### Added
-- Destination scan support for flags.
-- Testing against `tip` in Travis CI config.
-
-### Changed
-- Go version in Travis CI config.
-
-### Fixed
-- Removed redundant tests.
-- Use correct example naming in tests.
-
-## [1.10.2] - 2015-10-29 (backfilled 2016-04-25)
-### Fixed
-- Remove unused var in bash completion.
-
-## [1.10.1] - 2015-10-21 (backfilled 2016-04-25)
-### Added
-- Coverage and reference logos in README.
-
-### Fixed
-- Use specified values in help and version parsing.
-- Only display app version and help message once.
-
-## [1.10.0] - 2015-10-06 (backfilled 2016-04-25)
-### Added
-- More tests for existing functionality.
-- `ArgsUsage` at app and command level for help text flexibility.
-
-### Fixed
-- Honor `HideHelp` and `HideVersion` in `App.Run`.
-- Remove juvenile word from README.
-
-## [1.9.0] - 2015-09-08 (backfilled 2016-04-25)
-### Added
-- `FullName` on command with accompanying help output update.
-- Set default `$PROG` in bash completion.
-
-### Changed
-- Docs formatting.
-
-### Fixed
-- Removed self-referential imports in tests.
-
-## [1.8.0] - 2015-06-30 (backfilled 2016-04-25)
-### Added
-- Support for `Copyright` at app level.
-- `Parent` func at context level to walk up context lineage.
-
-### Fixed
-- Global flag processing at top level.
-
-## [1.7.1] - 2015-06-11 (backfilled 2016-04-25)
-### Added
-- Aggregate errors from `Before`/`After` funcs.
-- Doc comments on flag structs.
-- Include non-global flags when checking version and help.
-- Travis CI config updates.
-
-### Fixed
-- Ensure slice type flags have non-nil values.
-- Collect global flags from the full command hierarchy.
-- Docs prose.
-
-## [1.7.0] - 2015-05-03 (backfilled 2016-04-25)
-### Changed
-- `HelpPrinter` signature includes output writer.
-
-### Fixed
-- Specify go 1.1+ in docs.
-- Set `Writer` when running command as app.
-
-## [1.6.0] - 2015-03-23 (backfilled 2016-04-25)
-### Added
-- Multiple author support.
-- `NumFlags` at context level.
-- `Aliases` at command level.
-
-### Deprecated
-- `ShortName` at command level.
-
-### Fixed
-- Subcommand help output.
-- Backward compatible support for deprecated `Author` and `Email` fields.
-- Docs regarding `Names`/`Aliases`.
-
-## [1.5.0] - 2015-02-20 (backfilled 2016-04-25)
-### Added
-- `After` hook func support at app and command level.
-
-### Fixed
-- Use parsed context when running command as subcommand.
-- Docs prose.
-
-## [1.4.1] - 2015-01-09 (backfilled 2016-04-25)
-### Added
-- Support for hiding `-h / --help` flags, but not `help` subcommand.
-- Stop flag parsing after `--`.
-
-### Fixed
-- Help text for generic flags to specify single value.
-- Use double quotes in output for defaults.
-- Use `ParseInt` instead of `ParseUint` for int environment var values.
-- Use `0` as base when parsing int environment var values.
-
-## [1.4.0] - 2014-12-12 (backfilled 2016-04-25)
-### Added
-- Support for environment variable lookup "cascade".
-- Support for `Stdout` on app for output redirection.
-
-### Fixed
-- Print command help instead of app help in `ShowCommandHelp`.
-
-## [1.3.1] - 2014-11-13 (backfilled 2016-04-25)
-### Added
-- Docs and example code updates.
-
-### Changed
-- Default `-v / --version` flag made optional.
-
-## [1.3.0] - 2014-08-10 (backfilled 2016-04-25)
-### Added
-- `FlagNames` at context level.
-- Exposed `VersionPrinter` var for more control over version output.
-- Zsh completion hook.
-- `AUTHOR` section in default app help template.
-- Contribution guidelines.
-- `DurationFlag` type.
-
-## [1.2.0] - 2014-08-02
-### Added
-- Support for environment variable defaults on flags plus tests.
-
-## [1.1.0] - 2014-07-15
-### Added
-- Bash completion.
-- Optional hiding of built-in help command.
-- Optional skipping of flag parsing at command level.
-- `Author`, `Email`, and `Compiled` metadata on app.
-- `Before` hook func support at app and command level.
-- `CommandNotFound` func support at app level.
-- Command reference available on context.
-- `GenericFlag` type.
-- `Float64Flag` type.
-- `BoolTFlag` type.
-- `IsSet` flag helper on context.
-- More flag lookup funcs at context level.
-- More tests &amp; docs.
-
-### Changed
-- Help template updates to account for presence/absence of flags.
-- Separated subcommand help template.
-- Exposed `HelpPrinter` var for more control over help output.
-
-## [1.0.0] - 2013-11-01
-### Added
-- `help` flag in default app flag set and each command flag set.
-- Custom handling of argument parsing errors.
-- Command lookup by name at app level.
-- `StringSliceFlag` type and supporting `StringSlice` type.
-- `IntSliceFlag` type and supporting `IntSlice` type.
-- Slice type flag lookups by name at context level.
-- Export of app and command help functions.
-- More tests &amp; docs.
-
-## 0.1.0 - 2013-07-22
-### Added
-- Initial implementation.
-
-[Unreleased]: https://github.com/urfave/cli/compare/v1.18.0...HEAD
-[1.18.0]: https://github.com/urfave/cli/compare/v1.17.0...v1.18.0
-[1.17.0]: https://github.com/urfave/cli/compare/v1.16.0...v1.17.0
-[1.16.0]: https://github.com/urfave/cli/compare/v1.15.0...v1.16.0
-[1.15.0]: https://github.com/urfave/cli/compare/v1.14.0...v1.15.0
-[1.14.0]: https://github.com/urfave/cli/compare/v1.13.0...v1.14.0
-[1.13.0]: https://github.com/urfave/cli/compare/v1.12.0...v1.13.0
-[1.12.0]: https://github.com/urfave/cli/compare/v1.11.1...v1.12.0
-[1.11.1]: https://github.com/urfave/cli/compare/v1.11.0...v1.11.1
-[1.11.0]: https://github.com/urfave/cli/compare/v1.10.2...v1.11.0
-[1.10.2]: https://github.com/urfave/cli/compare/v1.10.1...v1.10.2
-[1.10.1]: https://github.com/urfave/cli/compare/v1.10.0...v1.10.1
-[1.10.0]: https://github.com/urfave/cli/compare/v1.9.0...v1.10.0
-[1.9.0]: https://github.com/urfave/cli/compare/v1.8.0...v1.9.0
-[1.8.0]: https://github.com/urfave/cli/compare/v1.7.1...v1.8.0
-[1.7.1]: https://github.com/urfave/cli/compare/v1.7.0...v1.7.1
-[1.7.0]: https://github.com/urfave/cli/compare/v1.6.0...v1.7.0
-[1.6.0]: https://github.com/urfave/cli/compare/v1.5.0...v1.6.0
-[1.5.0]: https://github.com/urfave/cli/compare/v1.4.1...v1.5.0
-[1.4.1]: https://github.com/urfave/cli/compare/v1.4.0...v1.4.1
-[1.4.0]: https://github.com/urfave/cli/compare/v1.3.1...v1.4.0
-[1.3.1]: https://github.com/urfave/cli/compare/v1.3.0...v1.3.1
-[1.3.0]: https://github.com/urfave/cli/compare/v1.2.0...v1.3.0
-[1.2.0]: https://github.com/urfave/cli/compare/v1.1.0...v1.2.0
-[1.1.0]: https://github.com/urfave/cli/compare/v1.0.0...v1.1.0
-[1.0.0]: https://github.com/urfave/cli/compare/v0.1.0...v1.0.0

+ 0 - 21
bashbrew/go/vendor/github.com/codegangsta/cli/LICENSE

@@ -1,21 +0,0 @@
-MIT License
-
-Copyright (c) 2016 Jeremy Saenz & Contributors
-
-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 - 1381
bashbrew/go/vendor/github.com/codegangsta/cli/README.md

@@ -1,1381 +0,0 @@
-cli
-===
-
-[![Build Status](https://travis-ci.org/urfave/cli.svg?branch=master)](https://travis-ci.org/urfave/cli)
-[![Windows Build Status](https://ci.appveyor.com/api/projects/status/rtgk5xufi932pb2v?svg=true)](https://ci.appveyor.com/project/urfave/cli)
-[![GoDoc](https://godoc.org/github.com/urfave/cli?status.svg)](https://godoc.org/github.com/urfave/cli)
-[![codebeat](https://codebeat.co/badges/0a8f30aa-f975-404b-b878-5fab3ae1cc5f)](https://codebeat.co/projects/github-com-urfave-cli)
-[![Go Report Card](https://goreportcard.com/badge/urfave/cli)](https://goreportcard.com/report/urfave/cli)
-[![top level coverage](https://gocover.io/_badge/github.com/urfave/cli?0 "top level coverage")](http://gocover.io/github.com/urfave/cli) /
-[![altsrc coverage](https://gocover.io/_badge/github.com/urfave/cli/altsrc?0 "altsrc coverage")](http://gocover.io/github.com/urfave/cli/altsrc)
-
-**Notice:** This is the library formerly known as
-`github.com/codegangsta/cli` -- Github will automatically redirect requests
-to this repository, but we recommend updating your references for clarity.
-
-cli is a simple, fast, and fun package for building command line apps in Go. The
-goal is to enable developers to write fast and distributable command line
-applications in an expressive way.
-
-<!-- toc -->
-
-- [Overview](#overview)
-- [Installation](#installation)
-  * [Supported platforms](#supported-platforms)
-  * [Using the `v2` branch](#using-the-v2-branch)
-  * [Pinning to the `v1` releases](#pinning-to-the-v1-releases)
-- [Getting Started](#getting-started)
-- [Examples](#examples)
-  * [Arguments](#arguments)
-  * [Flags](#flags)
-    + [Placeholder Values](#placeholder-values)
-    + [Alternate Names](#alternate-names)
-    + [Ordering](#ordering)
-    + [Values from the Environment](#values-from-the-environment)
-    + [Values from alternate input sources (YAML, TOML, and others)](#values-from-alternate-input-sources-yaml-toml-and-others)
-  * [Subcommands](#subcommands)
-  * [Subcommands categories](#subcommands-categories)
-  * [Exit code](#exit-code)
-  * [Bash Completion](#bash-completion)
-    + [Enabling](#enabling)
-    + [Distribution](#distribution)
-    + [Customization](#customization)
-  * [Generated Help Text](#generated-help-text)
-    + [Customization](#customization-1)
-  * [Version Flag](#version-flag)
-    + [Customization](#customization-2)
-    + [Full API Example](#full-api-example)
-- [Contribution Guidelines](#contribution-guidelines)
-
-<!-- tocstop -->
-
-## Overview
-
-Command line apps are usually so tiny that there is absolutely no reason why
-your code should *not* be self-documenting. Things like generating help text and
-parsing command flags/options should not hinder productivity when writing a
-command line app.
-
-**This is where cli comes into play.** cli makes command line programming fun,
-organized, and expressive!
-
-## Installation
-
-Make sure you have a working Go environment.  Go version 1.2+ is supported.  [See
-the install instructions for Go](http://golang.org/doc/install.html).
-
-To install cli, simply run:
-```
-$ go get github.com/urfave/cli
-```
-
-Make sure your `PATH` includes the `$GOPATH/bin` directory so your commands can
-be easily used:
-```
-export PATH=$PATH:$GOPATH/bin
-```
-
-### Supported platforms
-
-cli is tested against multiple versions of Go on Linux, and against the latest
-released version of Go on OS X and Windows.  For full details, see
-[`./.travis.yml`](./.travis.yml) and [`./appveyor.yml`](./appveyor.yml).
-
-### Using the `v2` branch
-
-**Warning**: The `v2` branch is currently unreleased and considered unstable.
-
-There is currently a long-lived branch named `v2` that is intended to land as
-the new `master` branch once development there has settled down.  The current
-`master` branch (mirrored as `v1`) is being manually merged into `v2` on
-an irregular human-based schedule, but generally if one wants to "upgrade" to
-`v2` *now* and accept the volatility (read: "awesomeness") that comes along with
-that, please use whatever version pinning of your preference, such as via
-`gopkg.in`:
-
-```
-$ go get gopkg.in/urfave/cli.v2
-```
-
-``` go
-...
-import (
-  "gopkg.in/urfave/cli.v2" // imports as package "cli"
-)
-...
-```
-
-### Pinning to the `v1` releases
-
-Similarly to the section above describing use of the `v2` branch, if one wants
-to avoid any unexpected compatibility pains once `v2` becomes `master`, then
-pinning to `v1` is an acceptable option, e.g.:
-
-```
-$ go get gopkg.in/urfave/cli.v1
-```
-
-``` go
-...
-import (
-  "gopkg.in/urfave/cli.v1" // imports as package "cli"
-)
-...
-```
-
-This will pull the latest tagged `v1` release (e.g. `v1.18.1` at the time of writing).
-
-## Getting Started
-
-One of the philosophies behind cli is that an API should be playful and full of
-discovery. So a cli app can be as little as one line of code in `main()`.
-
-<!-- {
-  "args": ["&#45;&#45;help"],
-  "output": "A new cli application"
-} -->
-``` go
-package main
-
-import (
-  "os"
-
-  "github.com/urfave/cli"
-)
-
-func main() {
-  cli.NewApp().Run(os.Args)
-}
-```
-
-This app will run and show help text, but is not very useful. Let's give an
-action to execute and some help documentation:
-
-<!-- {
-  "output": "boom! I say!"
-} -->
-``` go
-package main
-
-import (
-  "fmt"
-  "os"
-
-  "github.com/urfave/cli"
-)
-
-func main() {
-  app := cli.NewApp()
-  app.Name = "boom"
-  app.Usage = "make an explosive entrance"
-  app.Action = func(c *cli.Context) error {
-    fmt.Println("boom! I say!")
-    return nil
-  }
-
-  app.Run(os.Args)
-}
-```
-
-Running this already gives you a ton of functionality, plus support for things
-like subcommands and flags, which are covered below.
-
-## Examples
-
-Being a programmer can be a lonely job. Thankfully by the power of automation
-that is not the case! Let's create a greeter app to fend off our demons of
-loneliness!
-
-Start by creating a directory named `greet`, and within it, add a file,
-`greet.go` with the following code in it:
-
-<!-- {
-  "output": "Hello friend!"
-} -->
-``` go
-package main
-
-import (
-  "fmt"
-  "os"
-
-  "github.com/urfave/cli"
-)
-
-func main() {
-  app := cli.NewApp()
-  app.Name = "greet"
-  app.Usage = "fight the loneliness!"
-  app.Action = func(c *cli.Context) error {
-    fmt.Println("Hello friend!")
-    return nil
-  }
-
-  app.Run(os.Args)
-}
-```
-
-Install our command to the `$GOPATH/bin` directory:
-
-```
-$ go install
-```
-
-Finally run our new command:
-
-```
-$ greet
-Hello friend!
-```
-
-cli also generates neat help text:
-
-```
-$ greet help
-NAME:
-    greet - fight the loneliness!
-
-USAGE:
-    greet [global options] command [command options] [arguments...]
-
-VERSION:
-    0.0.0
-
-COMMANDS:
-    help, h  Shows a list of commands or help for one command
-
-GLOBAL OPTIONS
-    --version Shows version information
-```
-
-### Arguments
-
-You can lookup arguments by calling the `Args` function on `cli.Context`, e.g.:
-
-<!-- {
-  "output": "Hello \""
-} -->
-``` go
-package main
-
-import (
-  "fmt"
-  "os"
-
-  "github.com/urfave/cli"
-)
-
-func main() {
-  app := cli.NewApp()
-
-  app.Action = func(c *cli.Context) error {
-    fmt.Printf("Hello %q", c.Args().Get(0))
-    return nil
-  }
-
-  app.Run(os.Args)
-}
-```
-
-### Flags
-
-Setting and querying flags is simple.
-
-<!-- {
-  "output": "Hello Nefertiti"
-} -->
-``` go
-package main
-
-import (
-  "fmt"
-  "os"
-
-  "github.com/urfave/cli"
-)
-
-func main() {
-  app := cli.NewApp()
-
-  app.Flags = []cli.Flag {
-    cli.StringFlag{
-      Name: "lang",
-      Value: "english",
-      Usage: "language for the greeting",
-    },
-  }
-
-  app.Action = func(c *cli.Context) error {
-    name := "Nefertiti"
-    if c.NArg() > 0 {
-      name = c.Args().Get(0)
-    }
-    if c.String("lang") == "spanish" {
-      fmt.Println("Hola", name)
-    } else {
-      fmt.Println("Hello", name)
-    }
-    return nil
-  }
-
-  app.Run(os.Args)
-}
-```
-
-You can also set a destination variable for a flag, to which the content will be
-scanned.
-
-<!-- {
-  "output": "Hello someone"
-} -->
-``` go
-package main
-
-import (
-  "os"
-  "fmt"
-
-  "github.com/urfave/cli"
-)
-
-func main() {
-  var language string
-
-  app := cli.NewApp()
-
-  app.Flags = []cli.Flag {
-    cli.StringFlag{
-      Name:        "lang",
-      Value:       "english",
-      Usage:       "language for the greeting",
-      Destination: &language,
-    },
-  }
-
-  app.Action = func(c *cli.Context) error {
-    name := "someone"
-    if c.NArg() > 0 {
-      name = c.Args()[0]
-    }
-    if language == "spanish" {
-      fmt.Println("Hola", name)
-    } else {
-      fmt.Println("Hello", name)
-    }
-    return nil
-  }
-
-  app.Run(os.Args)
-}
-```
-
-See full list of flags at http://godoc.org/github.com/urfave/cli
-
-#### Placeholder Values
-
-Sometimes it's useful to specify a flag's value within the usage string itself.
-Such placeholders are indicated with back quotes.
-
-For example this:
-
-<!-- {
-  "args": ["&#45;&#45;help"],
-  "output": "&#45;&#45;config FILE, &#45;c FILE"
-} -->
-```go
-package main
-
-import (
-  "os"
-
-  "github.com/urfave/cli"
-)
-
-func main() {
-  app := cli.NewApp()
-
-  app.Flags = []cli.Flag{
-    cli.StringFlag{
-      Name:  "config, c",
-      Usage: "Load configuration from `FILE`",
-    },
-  }
-
-  app.Run(os.Args)
-}
-```
-
-Will result in help output like:
-
-```
---config FILE, -c FILE   Load configuration from FILE
-```
-
-Note that only the first placeholder is used. Subsequent back-quoted words will
-be left as-is.
-
-#### Alternate Names
-
-You can set alternate (or short) names for flags by providing a comma-delimited
-list for the `Name`. e.g.
-
-<!-- {
-  "args": ["&#45;&#45;help"],
-  "output": "&#45;&#45;lang value, &#45;l value.*language for the greeting.*default: \"english\""
-} -->
-``` go
-package main
-
-import (
-  "os"
-
-  "github.com/urfave/cli"
-)
-
-func main() {
-  app := cli.NewApp()
-
-  app.Flags = []cli.Flag {
-    cli.StringFlag{
-      Name: "lang, l",
-      Value: "english",
-      Usage: "language for the greeting",
-    },
-  }
-
-  app.Run(os.Args)
-}
-```
-
-That flag can then be set with `--lang spanish` or `-l spanish`. Note that
-giving two different forms of the same flag in the same command invocation is an
-error.
-
-#### Ordering
-
-Flags for the application and commands are shown in the order they are defined.
-However, it's possible to sort them from outside this library by using `FlagsByName`
-or `CommandsByName` with `sort`.
-
-For example this:
-
-<!-- {
-  "args": ["&#45;&#45;help"],
-  "output": "add a task to the list\n.*complete a task on the list\n.*\n\n.*\n.*Load configuration from FILE\n.*Language for the greeting.*"
-} -->
-``` go
-package main
-
-import (
-  "os"
-  "sort"
-
-  "github.com/urfave/cli"
-)
-
-func main() {
-  app := cli.NewApp()
-
-  app.Flags = []cli.Flag {
-    cli.StringFlag{
-      Name: "lang, l",
-      Value: "english",
-      Usage: "Language for the greeting",
-    },
-    cli.StringFlag{
-      Name: "config, c",
-      Usage: "Load configuration from `FILE`",
-    },
-  }
-
-  app.Commands = []cli.Command{
-    {
-      Name:    "complete",
-      Aliases: []string{"c"},
-      Usage:   "complete a task on the list",
-      Action:  func(c *cli.Context) error {
-        return nil
-      },
-    },
-    {
-      Name:    "add",
-      Aliases: []string{"a"},
-      Usage:   "add a task to the list",
-      Action:  func(c *cli.Context) error {
-        return nil
-      },
-    },
-  }
-
-  sort.Sort(cli.FlagsByName(app.Flags))
-  sort.Sort(cli.CommandsByName(app.Commands))
-
-  app.Run(os.Args)
-}
-```
-
-Will result in help output like:
-
-```
---config FILE, -c FILE  Load configuration from FILE
---lang value, -l value  Language for the greeting (default: "english")
-```
-
-#### Values from the Environment
-
-You can also have the default value set from the environment via `EnvVar`.  e.g.
-
-<!-- {
-  "args": ["&#45;&#45;help"],
-  "output": "language for the greeting.*APP_LANG"
-} -->
-``` go
-package main
-
-import (
-  "os"
-
-  "github.com/urfave/cli"
-)
-
-func main() {
-  app := cli.NewApp()
-
-  app.Flags = []cli.Flag {
-    cli.StringFlag{
-      Name: "lang, l",
-      Value: "english",
-      Usage: "language for the greeting",
-      EnvVar: "APP_LANG",
-    },
-  }
-
-  app.Run(os.Args)
-}
-```
-
-The `EnvVar` may also be given as a comma-delimited "cascade", where the first
-environment variable that resolves is used as the default.
-
-<!-- {
-  "args": ["&#45;&#45;help"],
-  "output": "language for the greeting.*LEGACY_COMPAT_LANG.*APP_LANG.*LANG"
-} -->
-``` go
-package main
-
-import (
-  "os"
-
-  "github.com/urfave/cli"
-)
-
-func main() {
-  app := cli.NewApp()
-
-  app.Flags = []cli.Flag {
-    cli.StringFlag{
-      Name: "lang, l",
-      Value: "english",
-      Usage: "language for the greeting",
-      EnvVar: "LEGACY_COMPAT_LANG,APP_LANG,LANG",
-    },
-  }
-
-  app.Run(os.Args)
-}
-```
-
-#### Values from alternate input sources (YAML, TOML, and others)
-
-There is a separate package altsrc that adds support for getting flag values
-from other file input sources.
-
-Currently supported input source formats:
-* YAML
-* TOML
-
-In order to get values for a flag from an alternate input source the following
-code would be added to wrap an existing cli.Flag like below:
-
-``` go
-  altsrc.NewIntFlag(cli.IntFlag{Name: "test"})
-```
-
-Initialization must also occur for these flags. Below is an example initializing
-getting data from a yaml file below.
-
-``` go
-  command.Before = altsrc.InitInputSourceWithContext(command.Flags, NewYamlSourceFromFlagFunc("load"))
-```
-
-The code above will use the "load" string as a flag name to get the file name of
-a yaml file from the cli.Context.  It will then use that file name to initialize
-the yaml input source for any flags that are defined on that command.  As a note
-the "load" flag used would also have to be defined on the command flags in order
-for this code snipped to work.
-
-Currently only the aboved specified formats are supported but developers can
-add support for other input sources by implementing the
-altsrc.InputSourceContext for their given sources.
-
-Here is a more complete sample of a command using YAML support:
-
-<!-- {
-  "args": ["test-cmd", "&#45;&#45;help"],
-  "output": "&#45&#45;test value.*default: 0"
-} -->
-``` go
-package notmain
-
-import (
-  "fmt"
-  "os"
-
-  "github.com/urfave/cli"
-  "github.com/urfave/cli/altsrc"
-)
-
-func main() {
-  app := cli.NewApp()
-
-  flags := []cli.Flag{
-    altsrc.NewIntFlag(cli.IntFlag{Name: "test"}),
-    cli.StringFlag{Name: "load"},
-  }
-
-  app.Action = func(c *cli.Context) error {
-    fmt.Println("yaml ist rad")
-    return nil
-  }
-
-  app.Before = altsrc.InitInputSourceWithContext(flags, altsrc.NewYamlSourceFromFlagFunc("load"))
-  app.Flags = flags
-
-  app.Run(os.Args)
-}
-```
-
-### Subcommands
-
-Subcommands can be defined for a more git-like command line app.
-
-<!-- {
-  "args": ["template", "add"],
-  "output": "new task template: .+"
-} -->
-```go
-package main
-
-import (
-  "fmt"
-  "os"
-
-  "github.com/urfave/cli"
-)
-
-func main() {
-  app := cli.NewApp()
-
-  app.Commands = []cli.Command{
-    {
-      Name:    "add",
-      Aliases: []string{"a"},
-      Usage:   "add a task to the list",
-      Action:  func(c *cli.Context) error {
-        fmt.Println("added task: ", c.Args().First())
-        return nil
-      },
-    },
-    {
-      Name:    "complete",
-      Aliases: []string{"c"},
-      Usage:   "complete a task on the list",
-      Action:  func(c *cli.Context) error {
-        fmt.Println("completed task: ", c.Args().First())
-        return nil
-      },
-    },
-    {
-      Name:        "template",
-      Aliases:     []string{"t"},
-      Usage:       "options for task templates",
-      Subcommands: []cli.Command{
-        {
-          Name:  "add",
-          Usage: "add a new template",
-          Action: func(c *cli.Context) error {
-            fmt.Println("new task template: ", c.Args().First())
-            return nil
-          },
-        },
-        {
-          Name:  "remove",
-          Usage: "remove an existing template",
-          Action: func(c *cli.Context) error {
-            fmt.Println("removed task template: ", c.Args().First())
-            return nil
-          },
-        },
-      },
-    },
-  }
-
-  app.Run(os.Args)
-}
-```
-
-### Subcommands categories
-
-For additional organization in apps that have many subcommands, you can
-associate a category for each command to group them together in the help
-output.
-
-E.g.
-
-```go
-package main
-
-import (
-  "os"
-
-  "github.com/urfave/cli"
-)
-
-func main() {
-  app := cli.NewApp()
-
-  app.Commands = []cli.Command{
-    {
-      Name: "noop",
-    },
-    {
-      Name:     "add",
-      Category: "template",
-    },
-    {
-      Name:     "remove",
-      Category: "template",
-    },
-  }
-
-  app.Run(os.Args)
-}
-```
-
-Will include:
-
-```
-COMMANDS:
-    noop
-
-  Template actions:
-    add
-    remove
-```
-
-### Exit code
-
-Calling `App.Run` will not automatically call `os.Exit`, which means that by
-default the exit code will "fall through" to being `0`.  An explicit exit code
-may be set by returning a non-nil error that fulfills `cli.ExitCoder`, *or* a
-`cli.MultiError` that includes an error that fulfills `cli.ExitCoder`, e.g.:
-
-``` go
-package main
-
-import (
-  "os"
-
-  "github.com/urfave/cli"
-)
-
-func main() {
-  app := cli.NewApp()
-  app.Flags = []cli.Flag{
-    cli.BoolTFlag{
-      Name:  "ginger-crouton",
-      Usage: "is it in the soup?",
-    },
-  }
-  app.Action = func(ctx *cli.Context) error {
-    if !ctx.Bool("ginger-crouton") {
-      return cli.NewExitError("it is not in the soup", 86)
-    }
-    return nil
-  }
-
-  app.Run(os.Args)
-}
-```
-
-### Bash Completion
-
-You can enable completion commands by setting the `EnableBashCompletion`
-flag on the `App` object.  By default, this setting will only auto-complete to
-show an app's subcommands, but you can write your own completion methods for
-the App or its subcommands.
-
-<!-- {
-  "args": ["complete", "&#45;&#45;generate&#45;bash&#45;completion"],
-  "output": "laundry"
-} -->
-``` go
-package main
-
-import (
-  "fmt"
-  "os"
-
-  "github.com/urfave/cli"
-)
-
-func main() {
-  tasks := []string{"cook", "clean", "laundry", "eat", "sleep", "code"}
-
-  app := cli.NewApp()
-  app.EnableBashCompletion = true
-  app.Commands = []cli.Command{
-    {
-      Name:  "complete",
-      Aliases: []string{"c"},
-      Usage: "complete a task on the list",
-      Action: func(c *cli.Context) error {
-         fmt.Println("completed task: ", c.Args().First())
-         return nil
-      },
-      BashComplete: func(c *cli.Context) {
-        // This will complete if no args are passed
-        if c.NArg() > 0 {
-          return
-        }
-        for _, t := range tasks {
-          fmt.Println(t)
-        }
-      },
-    },
-  }
-
-  app.Run(os.Args)
-}
-```
-
-#### Enabling
-
-Source the `autocomplete/bash_autocomplete` file in your `.bashrc` file while
-setting the `PROG` variable to the name of your program:
-
-`PROG=myprogram source /.../cli/autocomplete/bash_autocomplete`
-
-#### Distribution
-
-Copy `autocomplete/bash_autocomplete` into `/etc/bash_completion.d/` and rename
-it to the name of the program you wish to add autocomplete support for (or
-automatically install it there if you are distributing a package). Don't forget
-to source the file to make it active in the current shell.
-
-```
-sudo cp src/bash_autocomplete /etc/bash_completion.d/<myprogram>
-source /etc/bash_completion.d/<myprogram>
-```
-
-Alternatively, you can just document that users should source the generic
-`autocomplete/bash_autocomplete` in their bash configuration with `$PROG` set
-to the name of their program (as above).
-
-#### Customization
-
-The default bash completion flag (`--generate-bash-completion`) is defined as
-`cli.BashCompletionFlag`, and may be redefined if desired, e.g.:
-
-<!-- {
-  "args": ["&#45;&#45;compgen"],
-  "output": "wat\nhelp\nh"
-} -->
-``` go
-package main
-
-import (
-  "os"
-
-  "github.com/urfave/cli"
-)
-
-func main() {
-  cli.BashCompletionFlag = cli.BoolFlag{
-    Name:   "compgen",
-    Hidden: true,
-  }
-
-  app := cli.NewApp()
-  app.EnableBashCompletion = true
-  app.Commands = []cli.Command{
-    {
-      Name: "wat",
-    },
-  }
-  app.Run(os.Args)
-}
-```
-
-### Generated Help Text
-
-The default help flag (`-h/--help`) is defined as `cli.HelpFlag` and is checked
-by the cli internals in order to print generated help text for the app, command,
-or subcommand, and break execution.
-
-#### Customization
-
-All of the help text generation may be customized, and at multiple levels.  The
-templates are exposed as variables `AppHelpTemplate`, `CommandHelpTemplate`, and
-`SubcommandHelpTemplate` which may be reassigned or augmented, and full override
-is possible by assigning a compatible func to the `cli.HelpPrinter` variable,
-e.g.:
-
-<!-- {
-  "output": "Ha HA.  I pwnd the help!!1"
-} -->
-``` go
-package main
-
-import (
-  "fmt"
-  "io"
-  "os"
-
-  "github.com/urfave/cli"
-)
-
-func main() {
-  // EXAMPLE: Append to an existing template
-  cli.AppHelpTemplate = fmt.Sprintf(`%s
-
-WEBSITE: http://awesometown.example.com
-
-SUPPORT: [email protected]
-
-`, cli.AppHelpTemplate)
-
-  // EXAMPLE: Override a template
-  cli.AppHelpTemplate = `NAME:
-   {{.Name}} - {{.Usage}}
-USAGE:
-   {{.HelpName}} {{if .VisibleFlags}}[global options]{{end}}{{if .Commands}} command [command options]{{end}} {{if .ArgsUsage}}{{.ArgsUsage}}{{else}}[arguments...]{{end}}
-   {{if len .Authors}}
-AUTHOR:
-   {{range .Authors}}{{ . }}{{end}}
-   {{end}}{{if .Commands}}
-COMMANDS:
-{{range .Commands}}{{if not .HideHelp}}   {{join .Names ", "}}{{ "\t"}}{{.Usage}}{{ "\n" }}{{end}}{{end}}{{end}}{{if .VisibleFlags}}
-GLOBAL OPTIONS:
-   {{range .VisibleFlags}}{{.}}
-   {{end}}{{end}}{{if .Copyright }}
-COPYRIGHT:
-   {{.Copyright}}
-   {{end}}{{if .Version}}
-VERSION:
-   {{.Version}}
-   {{end}}
-`
-
-  // EXAMPLE: Replace the `HelpPrinter` func
-  cli.HelpPrinter = func(w io.Writer, templ string, data interface{}) {
-    fmt.Println("Ha HA.  I pwnd the help!!1")
-  }
-
-  cli.NewApp().Run(os.Args)
-}
-```
-
-The default flag may be customized to something other than `-h/--help` by
-setting `cli.HelpFlag`, e.g.:
-
-<!-- {
-  "args": ["&#45;&#45halp"],
-  "output": "haaaaalp.*HALP"
-} -->
-``` go
-package main
-
-import (
-  "os"
-
-  "github.com/urfave/cli"
-)
-
-func main() {
-  cli.HelpFlag = cli.BoolFlag{
-    Name: "halp, haaaaalp",
-    Usage: "HALP",
-    EnvVar: "SHOW_HALP,HALPPLZ",
-  }
-
-  cli.NewApp().Run(os.Args)
-}
-```
-
-### Version Flag
-
-The default version flag (`-v/--version`) is defined as `cli.VersionFlag`, which
-is checked by the cli internals in order to print the `App.Version` via
-`cli.VersionPrinter` and break execution.
-
-#### Customization
-
-The default flag may be customized to something other than `-v/--version` by
-setting `cli.VersionFlag`, e.g.:
-
-<!-- {
-  "args": ["&#45;&#45print-version"],
-  "output": "partay version 19\\.99\\.0"
-} -->
-``` go
-package main
-
-import (
-  "os"
-
-  "github.com/urfave/cli"
-)
-
-func main() {
-  cli.VersionFlag = cli.BoolFlag{
-    Name: "print-version, V",
-    Usage: "print only the version",
-  }
-
-  app := cli.NewApp()
-  app.Name = "partay"
-  app.Version = "19.99.0"
-  app.Run(os.Args)
-}
-```
-
-Alternatively, the version printer at `cli.VersionPrinter` may be overridden, e.g.:
-
-<!-- {
-  "args": ["&#45;&#45version"],
-  "output": "version=19\\.99\\.0 revision=fafafaf"
-} -->
-``` go
-package main
-
-import (
-  "fmt"
-  "os"
-
-  "github.com/urfave/cli"
-)
-
-var (
-  Revision = "fafafaf"
-)
-
-func main() {
-  cli.VersionPrinter = func(c *cli.Context) {
-    fmt.Printf("version=%s revision=%s\n", c.App.Version, Revision)
-  }
-
-  app := cli.NewApp()
-  app.Name = "partay"
-  app.Version = "19.99.0"
-  app.Run(os.Args)
-}
-```
-
-#### Full API Example
-
-**Notice**: This is a contrived (functioning) example meant strictly for API
-demonstration purposes.  Use of one's imagination is encouraged.
-
-<!-- {
-  "output": "made it!\nPhew!"
-} -->
-``` go
-package main
-
-import (
-  "errors"
-  "flag"
-  "fmt"
-  "io"
-  "io/ioutil"
-  "os"
-  "time"
-
-  "github.com/urfave/cli"
-)
-
-func init() {
-  cli.AppHelpTemplate += "\nCUSTOMIZED: you bet ur muffins\n"
-  cli.CommandHelpTemplate += "\nYMMV\n"
-  cli.SubcommandHelpTemplate += "\nor something\n"
-
-  cli.HelpFlag = cli.BoolFlag{Name: "halp"}
-  cli.BashCompletionFlag = cli.BoolFlag{Name: "compgen", Hidden: true}
-  cli.VersionFlag = cli.BoolFlag{Name: "print-version, V"}
-
-  cli.HelpPrinter = func(w io.Writer, templ string, data interface{}) {
-    fmt.Fprintf(w, "best of luck to you\n")
-  }
-  cli.VersionPrinter = func(c *cli.Context) {
-    fmt.Fprintf(c.App.Writer, "version=%s\n", c.App.Version)
-  }
-  cli.OsExiter = func(c int) {
-    fmt.Fprintf(cli.ErrWriter, "refusing to exit %d\n", c)
-  }
-  cli.ErrWriter = ioutil.Discard
-  cli.FlagStringer = func(fl cli.Flag) string {
-    return fmt.Sprintf("\t\t%s", fl.GetName())
-  }
-}
-
-type hexWriter struct{}
-
-func (w *hexWriter) Write(p []byte) (int, error) {
-  for _, b := range p {
-    fmt.Printf("%x", b)
-  }
-  fmt.Printf("\n")
-
-  return len(p), nil
-}
-
-type genericType struct{
-  s string
-}
-
-func (g *genericType) Set(value string) error {
-  g.s = value
-  return nil
-}
-
-func (g *genericType) String() string {
-  return g.s
-}
-
-func main() {
-  app := cli.NewApp()
-  app.Name = "kənˈtrīv"
-  app.Version = "19.99.0"
-  app.Compiled = time.Now()
-  app.Authors = []cli.Author{
-    cli.Author{
-      Name:  "Example Human",
-      Email: "[email protected]",
-    },
-  }
-  app.Copyright = "(c) 1999 Serious Enterprise"
-  app.HelpName = "contrive"
-  app.Usage = "demonstrate available API"
-  app.UsageText = "contrive - demonstrating the available API"
-  app.ArgsUsage = "[args and such]"
-  app.Commands = []cli.Command{
-    cli.Command{
-      Name:        "doo",
-      Aliases:     []string{"do"},
-      Category:    "motion",
-      Usage:       "do the doo",
-      UsageText:   "doo - does the dooing",
-      Description: "no really, there is a lot of dooing to be done",
-      ArgsUsage:   "[arrgh]",
-      Flags: []cli.Flag{
-        cli.BoolFlag{Name: "forever, forevvarr"},
-      },
-      Subcommands: cli.Commands{
-        cli.Command{
-          Name:   "wop",
-          Action: wopAction,
-        },
-      },
-      SkipFlagParsing: false,
-      HideHelp:        false,
-      Hidden:          false,
-      HelpName:        "doo!",
-      BashComplete: func(c *cli.Context) {
-        fmt.Fprintf(c.App.Writer, "--better\n")
-      },
-      Before: func(c *cli.Context) error {
-        fmt.Fprintf(c.App.Writer, "brace for impact\n")
-        return nil
-      },
-      After: func(c *cli.Context) error {
-        fmt.Fprintf(c.App.Writer, "did we lose anyone?\n")
-        return nil
-      },
-      Action: func(c *cli.Context) error {
-        c.Command.FullName()
-        c.Command.HasName("wop")
-        c.Command.Names()
-        c.Command.VisibleFlags()
-        fmt.Fprintf(c.App.Writer, "dodododododoodododddooooododododooo\n")
-        if c.Bool("forever") {
-          c.Command.Run(c)
-        }
-        return nil
-      },
-      OnUsageError: func(c *cli.Context, err error, isSubcommand bool) error {
-        fmt.Fprintf(c.App.Writer, "for shame\n")
-        return err
-      },
-    },
-  }
-  app.Flags = []cli.Flag{
-    cli.BoolFlag{Name: "fancy"},
-    cli.BoolTFlag{Name: "fancier"},
-    cli.DurationFlag{Name: "howlong, H", Value: time.Second * 3},
-    cli.Float64Flag{Name: "howmuch"},
-    cli.GenericFlag{Name: "wat", Value: &genericType{}},
-    cli.Int64Flag{Name: "longdistance"},
-    cli.Int64SliceFlag{Name: "intervals"},
-    cli.IntFlag{Name: "distance"},
-    cli.IntSliceFlag{Name: "times"},
-    cli.StringFlag{Name: "dance-move, d"},
-    cli.StringSliceFlag{Name: "names, N"},
-    cli.UintFlag{Name: "age"},
-    cli.Uint64Flag{Name: "bigage"},
-  }
-  app.EnableBashCompletion = true
-  app.HideHelp = false
-  app.HideVersion = false
-  app.BashComplete = func(c *cli.Context) {
-    fmt.Fprintf(c.App.Writer, "lipstick\nkiss\nme\nlipstick\nringo\n")
-  }
-  app.Before = func(c *cli.Context) error {
-    fmt.Fprintf(c.App.Writer, "HEEEERE GOES\n")
-    return nil
-  }
-  app.After = func(c *cli.Context) error {
-    fmt.Fprintf(c.App.Writer, "Phew!\n")
-    return nil
-  }
-  app.CommandNotFound = func(c *cli.Context, command string) {
-    fmt.Fprintf(c.App.Writer, "Thar be no %q here.\n", command)
-  }
-  app.OnUsageError = func(c *cli.Context, err error, isSubcommand bool) error {
-    if isSubcommand {
-      return err
-    }
-
-    fmt.Fprintf(c.App.Writer, "WRONG: %#v\n", err)
-    return nil
-  }
-  app.Action = func(c *cli.Context) error {
-    cli.DefaultAppComplete(c)
-    cli.HandleExitCoder(errors.New("not an exit coder, though"))
-    cli.ShowAppHelp(c)
-    cli.ShowCommandCompletions(c, "nope")
-    cli.ShowCommandHelp(c, "also-nope")
-    cli.ShowCompletions(c)
-    cli.ShowSubcommandHelp(c)
-    cli.ShowVersion(c)
-
-    categories := c.App.Categories()
-    categories.AddCommand("sounds", cli.Command{
-      Name: "bloop",
-    })
-
-    for _, category := range c.App.Categories() {
-      fmt.Fprintf(c.App.Writer, "%s\n", category.Name)
-      fmt.Fprintf(c.App.Writer, "%#v\n", category.Commands)
-      fmt.Fprintf(c.App.Writer, "%#v\n", category.VisibleCommands())
-    }
-
-    fmt.Printf("%#v\n", c.App.Command("doo"))
-    if c.Bool("infinite") {
-      c.App.Run([]string{"app", "doo", "wop"})
-    }
-
-    if c.Bool("forevar") {
-      c.App.RunAsSubcommand(c)
-    }
-    c.App.Setup()
-    fmt.Printf("%#v\n", c.App.VisibleCategories())
-    fmt.Printf("%#v\n", c.App.VisibleCommands())
-    fmt.Printf("%#v\n", c.App.VisibleFlags())
-
-    fmt.Printf("%#v\n", c.Args().First())
-    if len(c.Args()) > 0 {
-      fmt.Printf("%#v\n", c.Args()[1])
-    }
-    fmt.Printf("%#v\n", c.Args().Present())
-    fmt.Printf("%#v\n", c.Args().Tail())
-
-    set := flag.NewFlagSet("contrive", 0)
-    nc := cli.NewContext(c.App, set, c)
-
-    fmt.Printf("%#v\n", nc.Args())
-    fmt.Printf("%#v\n", nc.Bool("nope"))
-    fmt.Printf("%#v\n", nc.BoolT("nerp"))
-    fmt.Printf("%#v\n", nc.Duration("howlong"))
-    fmt.Printf("%#v\n", nc.Float64("hay"))
-    fmt.Printf("%#v\n", nc.Generic("bloop"))
-    fmt.Printf("%#v\n", nc.Int64("bonk"))
-    fmt.Printf("%#v\n", nc.Int64Slice("burnks"))
-    fmt.Printf("%#v\n", nc.Int("bips"))
-    fmt.Printf("%#v\n", nc.IntSlice("blups"))
-    fmt.Printf("%#v\n", nc.String("snurt"))
-    fmt.Printf("%#v\n", nc.StringSlice("snurkles"))
-    fmt.Printf("%#v\n", nc.Uint("flub"))
-    fmt.Printf("%#v\n", nc.Uint64("florb"))
-    fmt.Printf("%#v\n", nc.GlobalBool("global-nope"))
-    fmt.Printf("%#v\n", nc.GlobalBoolT("global-nerp"))
-    fmt.Printf("%#v\n", nc.GlobalDuration("global-howlong"))
-    fmt.Printf("%#v\n", nc.GlobalFloat64("global-hay"))
-    fmt.Printf("%#v\n", nc.GlobalGeneric("global-bloop"))
-    fmt.Printf("%#v\n", nc.GlobalInt("global-bips"))
-    fmt.Printf("%#v\n", nc.GlobalIntSlice("global-blups"))
-    fmt.Printf("%#v\n", nc.GlobalString("global-snurt"))
-    fmt.Printf("%#v\n", nc.GlobalStringSlice("global-snurkles"))
-
-    fmt.Printf("%#v\n", nc.FlagNames())
-    fmt.Printf("%#v\n", nc.GlobalFlagNames())
-    fmt.Printf("%#v\n", nc.GlobalIsSet("wat"))
-    fmt.Printf("%#v\n", nc.GlobalSet("wat", "nope"))
-    fmt.Printf("%#v\n", nc.NArg())
-    fmt.Printf("%#v\n", nc.NumFlags())
-    fmt.Printf("%#v\n", nc.Parent())
-
-    nc.Set("wat", "also-nope")
-
-    ec := cli.NewExitError("ohwell", 86)
-    fmt.Fprintf(c.App.Writer, "%d", ec.ExitCode())
-    fmt.Printf("made it!\n")
-    return ec
-  }
-
-  if os.Getenv("HEXY") != "" {
-    app.Writer = &hexWriter{}
-    app.ErrWriter = &hexWriter{}
-  }
-
-  app.Metadata = map[string]interface{}{
-    "layers":     "many",
-    "explicable": false,
-    "whatever-values": 19.99,
-  }
-
-  app.Run(os.Args)
-}
-
-func wopAction(c *cli.Context) error {
-  fmt.Fprintf(c.App.Writer, ":wave: over here, eh\n")
-  return nil
-}
-```
-
-## Contribution Guidelines
-
-Feel free to put up a pull request to fix a bug or maybe add a feature. I will
-give it a code review and make sure that it does not break backwards
-compatibility. If I or any other collaborators agree that it is in line with
-the vision of the project, we will work with you to get the code into
-a mergeable state and merge it into the master branch.
-
-If you have contributed something significant to the project, we will most
-likely add you as a collaborator. As a collaborator you are given the ability
-to merge others pull requests. It is very important that new code does not
-break existing code, so be careful about what code you do choose to merge.
-
-If you feel like you have contributed to the project but have not yet been
-added as a collaborator, we probably forgot to add you, please open an issue.

+ 0 - 497
bashbrew/go/vendor/github.com/codegangsta/cli/app.go

@@ -1,497 +0,0 @@
-package cli
-
-import (
-	"fmt"
-	"io"
-	"io/ioutil"
-	"os"
-	"path/filepath"
-	"sort"
-	"time"
-)
-
-var (
-	changeLogURL                    = "https://github.com/urfave/cli/blob/master/CHANGELOG.md"
-	appActionDeprecationURL         = fmt.Sprintf("%s#deprecated-cli-app-action-signature", changeLogURL)
-	runAndExitOnErrorDeprecationURL = fmt.Sprintf("%s#deprecated-cli-app-runandexitonerror", changeLogURL)
-
-	contactSysadmin = "This is an error in the application.  Please contact the distributor of this application if this is not you."
-
-	errInvalidActionType = NewExitError("ERROR invalid Action type. "+
-		fmt.Sprintf("Must be `func(*Context`)` or `func(*Context) error).  %s", contactSysadmin)+
-		fmt.Sprintf("See %s", appActionDeprecationURL), 2)
-)
-
-// App is the main structure of a cli application. It is recommended that
-// an app be created with the cli.NewApp() function
-type App struct {
-	// The name of the program. Defaults to path.Base(os.Args[0])
-	Name string
-	// Full name of command for help, defaults to Name
-	HelpName string
-	// Description of the program.
-	Usage string
-	// Text to override the USAGE section of help
-	UsageText string
-	// Description of the program argument format.
-	ArgsUsage string
-	// Version of the program
-	Version string
-	// Description of the program
-	Description string
-	// List of commands to execute
-	Commands []Command
-	// List of flags to parse
-	Flags []Flag
-	// Boolean to enable bash completion commands
-	EnableBashCompletion bool
-	// Boolean to hide built-in help command
-	HideHelp bool
-	// Boolean to hide built-in version flag and the VERSION section of help
-	HideVersion bool
-	// Populate on app startup, only gettable through method Categories()
-	categories CommandCategories
-	// An action to execute when the bash-completion flag is set
-	BashComplete BashCompleteFunc
-	// An action to execute before any subcommands are run, but after the context is ready
-	// If a non-nil error is returned, no subcommands are run
-	Before BeforeFunc
-	// An action to execute after any subcommands are run, but after the subcommand has finished
-	// It is run even if Action() panics
-	After AfterFunc
-
-	// The action to execute when no subcommands are specified
-	// Expects a `cli.ActionFunc` but will accept the *deprecated* signature of `func(*cli.Context) {}`
-	// *Note*: support for the deprecated `Action` signature will be removed in a future version
-	Action interface{}
-
-	// Execute this function if the proper command cannot be found
-	CommandNotFound CommandNotFoundFunc
-	// Execute this function if an usage error occurs
-	OnUsageError OnUsageErrorFunc
-	// Compilation date
-	Compiled time.Time
-	// List of all authors who contributed
-	Authors []Author
-	// Copyright of the binary if any
-	Copyright string
-	// Name of Author (Note: Use App.Authors, this is deprecated)
-	Author string
-	// Email of Author (Note: Use App.Authors, this is deprecated)
-	Email string
-	// Writer writer to write output to
-	Writer io.Writer
-	// ErrWriter writes error output
-	ErrWriter io.Writer
-	// Other custom info
-	Metadata map[string]interface{}
-	// Carries a function which returns app specific info.
-	ExtraInfo func() map[string]string
-	// CustomAppHelpTemplate the text template for app help topic.
-	// cli.go uses text/template to render templates. You can
-	// render custom help text by setting this variable.
-	CustomAppHelpTemplate string
-
-	didSetup bool
-}
-
-// Tries to find out when this binary was compiled.
-// Returns the current time if it fails to find it.
-func compileTime() time.Time {
-	info, err := os.Stat(os.Args[0])
-	if err != nil {
-		return time.Now()
-	}
-	return info.ModTime()
-}
-
-// NewApp creates a new cli Application with some reasonable defaults for Name,
-// Usage, Version and Action.
-func NewApp() *App {
-	return &App{
-		Name:         filepath.Base(os.Args[0]),
-		HelpName:     filepath.Base(os.Args[0]),
-		Usage:        "A new cli application",
-		UsageText:    "",
-		Version:      "0.0.0",
-		BashComplete: DefaultAppComplete,
-		Action:       helpCommand.Action,
-		Compiled:     compileTime(),
-		Writer:       os.Stdout,
-	}
-}
-
-// Setup runs initialization code to ensure all data structures are ready for
-// `Run` or inspection prior to `Run`.  It is internally called by `Run`, but
-// will return early if setup has already happened.
-func (a *App) Setup() {
-	if a.didSetup {
-		return
-	}
-
-	a.didSetup = true
-
-	if a.Author != "" || a.Email != "" {
-		a.Authors = append(a.Authors, Author{Name: a.Author, Email: a.Email})
-	}
-
-	newCmds := []Command{}
-	for _, c := range a.Commands {
-		if c.HelpName == "" {
-			c.HelpName = fmt.Sprintf("%s %s", a.HelpName, c.Name)
-		}
-		newCmds = append(newCmds, c)
-	}
-	a.Commands = newCmds
-
-	if a.Command(helpCommand.Name) == nil && !a.HideHelp {
-		a.Commands = append(a.Commands, helpCommand)
-		if (HelpFlag != BoolFlag{}) {
-			a.appendFlag(HelpFlag)
-		}
-	}
-
-	if !a.HideVersion {
-		a.appendFlag(VersionFlag)
-	}
-
-	a.categories = CommandCategories{}
-	for _, command := range a.Commands {
-		a.categories = a.categories.AddCommand(command.Category, command)
-	}
-	sort.Sort(a.categories)
-
-	if a.Metadata == nil {
-		a.Metadata = make(map[string]interface{})
-	}
-
-	if a.Writer == nil {
-		a.Writer = os.Stdout
-	}
-}
-
-// Run is the entry point to the cli app. Parses the arguments slice and routes
-// to the proper flag/args combination
-func (a *App) Run(arguments []string) (err error) {
-	a.Setup()
-
-	// handle the completion flag separately from the flagset since
-	// completion could be attempted after a flag, but before its value was put
-	// on the command line. this causes the flagset to interpret the completion
-	// flag name as the value of the flag before it which is undesirable
-	// note that we can only do this because the shell autocomplete function
-	// always appends the completion flag at the end of the command
-	shellComplete, arguments := checkShellCompleteFlag(a, arguments)
-
-	// parse flags
-	set, err := flagSet(a.Name, a.Flags)
-	if err != nil {
-		return err
-	}
-
-	set.SetOutput(ioutil.Discard)
-	err = set.Parse(arguments[1:])
-	nerr := normalizeFlags(a.Flags, set)
-	context := NewContext(a, set, nil)
-	if nerr != nil {
-		fmt.Fprintln(a.Writer, nerr)
-		ShowAppHelp(context)
-		return nerr
-	}
-	context.shellComplete = shellComplete
-
-	if checkCompletions(context) {
-		return nil
-	}
-
-	if err != nil {
-		if a.OnUsageError != nil {
-			err := a.OnUsageError(context, err, false)
-			HandleExitCoder(err)
-			return err
-		}
-		fmt.Fprintf(a.Writer, "%s %s\n\n", "Incorrect Usage.", err.Error())
-		ShowAppHelp(context)
-		return err
-	}
-
-	if !a.HideHelp && checkHelp(context) {
-		ShowAppHelp(context)
-		return nil
-	}
-
-	if !a.HideVersion && checkVersion(context) {
-		ShowVersion(context)
-		return nil
-	}
-
-	if a.After != nil {
-		defer func() {
-			if afterErr := a.After(context); afterErr != nil {
-				if err != nil {
-					err = NewMultiError(err, afterErr)
-				} else {
-					err = afterErr
-				}
-			}
-		}()
-	}
-
-	if a.Before != nil {
-		beforeErr := a.Before(context)
-		if beforeErr != nil {
-			ShowAppHelp(context)
-			HandleExitCoder(beforeErr)
-			err = beforeErr
-			return err
-		}
-	}
-
-	args := context.Args()
-	if args.Present() {
-		name := args.First()
-		c := a.Command(name)
-		if c != nil {
-			return c.Run(context)
-		}
-	}
-
-	if a.Action == nil {
-		a.Action = helpCommand.Action
-	}
-
-	// Run default Action
-	err = HandleAction(a.Action, context)
-
-	HandleExitCoder(err)
-	return err
-}
-
-// RunAndExitOnError calls .Run() and exits non-zero if an error was returned
-//
-// Deprecated: instead you should return an error that fulfills cli.ExitCoder
-// to cli.App.Run. This will cause the application to exit with the given eror
-// code in the cli.ExitCoder
-func (a *App) RunAndExitOnError() {
-	if err := a.Run(os.Args); err != nil {
-		fmt.Fprintln(a.errWriter(), err)
-		OsExiter(1)
-	}
-}
-
-// RunAsSubcommand invokes the subcommand given the context, parses ctx.Args() to
-// generate command-specific flags
-func (a *App) RunAsSubcommand(ctx *Context) (err error) {
-	// append help to commands
-	if len(a.Commands) > 0 {
-		if a.Command(helpCommand.Name) == nil && !a.HideHelp {
-			a.Commands = append(a.Commands, helpCommand)
-			if (HelpFlag != BoolFlag{}) {
-				a.appendFlag(HelpFlag)
-			}
-		}
-	}
-
-	newCmds := []Command{}
-	for _, c := range a.Commands {
-		if c.HelpName == "" {
-			c.HelpName = fmt.Sprintf("%s %s", a.HelpName, c.Name)
-		}
-		newCmds = append(newCmds, c)
-	}
-	a.Commands = newCmds
-
-	// parse flags
-	set, err := flagSet(a.Name, a.Flags)
-	if err != nil {
-		return err
-	}
-
-	set.SetOutput(ioutil.Discard)
-	err = set.Parse(ctx.Args().Tail())
-	nerr := normalizeFlags(a.Flags, set)
-	context := NewContext(a, set, ctx)
-
-	if nerr != nil {
-		fmt.Fprintln(a.Writer, nerr)
-		fmt.Fprintln(a.Writer)
-		if len(a.Commands) > 0 {
-			ShowSubcommandHelp(context)
-		} else {
-			ShowCommandHelp(ctx, context.Args().First())
-		}
-		return nerr
-	}
-
-	if checkCompletions(context) {
-		return nil
-	}
-
-	if err != nil {
-		if a.OnUsageError != nil {
-			err = a.OnUsageError(context, err, true)
-			HandleExitCoder(err)
-			return err
-		}
-		fmt.Fprintf(a.Writer, "%s %s\n\n", "Incorrect Usage.", err.Error())
-		ShowSubcommandHelp(context)
-		return err
-	}
-
-	if len(a.Commands) > 0 {
-		if checkSubcommandHelp(context) {
-			return nil
-		}
-	} else {
-		if checkCommandHelp(ctx, context.Args().First()) {
-			return nil
-		}
-	}
-
-	if a.After != nil {
-		defer func() {
-			afterErr := a.After(context)
-			if afterErr != nil {
-				HandleExitCoder(err)
-				if err != nil {
-					err = NewMultiError(err, afterErr)
-				} else {
-					err = afterErr
-				}
-			}
-		}()
-	}
-
-	if a.Before != nil {
-		beforeErr := a.Before(context)
-		if beforeErr != nil {
-			HandleExitCoder(beforeErr)
-			err = beforeErr
-			return err
-		}
-	}
-
-	args := context.Args()
-	if args.Present() {
-		name := args.First()
-		c := a.Command(name)
-		if c != nil {
-			return c.Run(context)
-		}
-	}
-
-	// Run default Action
-	err = HandleAction(a.Action, context)
-
-	HandleExitCoder(err)
-	return err
-}
-
-// Command returns the named command on App. Returns nil if the command does not exist
-func (a *App) Command(name string) *Command {
-	for _, c := range a.Commands {
-		if c.HasName(name) {
-			return &c
-		}
-	}
-
-	return nil
-}
-
-// Categories returns a slice containing all the categories with the commands they contain
-func (a *App) Categories() CommandCategories {
-	return a.categories
-}
-
-// VisibleCategories returns a slice of categories and commands that are
-// Hidden=false
-func (a *App) VisibleCategories() []*CommandCategory {
-	ret := []*CommandCategory{}
-	for _, category := range a.categories {
-		if visible := func() *CommandCategory {
-			for _, command := range category.Commands {
-				if !command.Hidden {
-					return category
-				}
-			}
-			return nil
-		}(); visible != nil {
-			ret = append(ret, visible)
-		}
-	}
-	return ret
-}
-
-// VisibleCommands returns a slice of the Commands with Hidden=false
-func (a *App) VisibleCommands() []Command {
-	ret := []Command{}
-	for _, command := range a.Commands {
-		if !command.Hidden {
-			ret = append(ret, command)
-		}
-	}
-	return ret
-}
-
-// VisibleFlags returns a slice of the Flags with Hidden=false
-func (a *App) VisibleFlags() []Flag {
-	return visibleFlags(a.Flags)
-}
-
-func (a *App) hasFlag(flag Flag) bool {
-	for _, f := range a.Flags {
-		if flag == f {
-			return true
-		}
-	}
-
-	return false
-}
-
-func (a *App) errWriter() io.Writer {
-
-	// When the app ErrWriter is nil use the package level one.
-	if a.ErrWriter == nil {
-		return ErrWriter
-	}
-
-	return a.ErrWriter
-}
-
-func (a *App) appendFlag(flag Flag) {
-	if !a.hasFlag(flag) {
-		a.Flags = append(a.Flags, flag)
-	}
-}
-
-// Author represents someone who has contributed to a cli project.
-type Author struct {
-	Name  string // The Authors name
-	Email string // The Authors email
-}
-
-// String makes Author comply to the Stringer interface, to allow an easy print in the templating process
-func (a Author) String() string {
-	e := ""
-	if a.Email != "" {
-		e = " <" + a.Email + ">"
-	}
-
-	return fmt.Sprintf("%v%v", a.Name, e)
-}
-
-// HandleAction attempts to figure out which Action signature was used.  If
-// it's an ActionFunc or a func with the legacy signature for Action, the func
-// is run!
-func HandleAction(action interface{}, context *Context) (err error) {
-	if a, ok := action.(ActionFunc); ok {
-		return a(context)
-	} else if a, ok := action.(func(*Context) error); ok {
-		return a(context)
-	} else if a, ok := action.(func(*Context)); ok { // deprecated function signature
-		a(context)
-		return nil
-	} else {
-		return errInvalidActionType
-	}
-}

+ 0 - 26
bashbrew/go/vendor/github.com/codegangsta/cli/appveyor.yml

@@ -1,26 +0,0 @@
-version: "{build}"
-
-os: Windows Server 2016
-
-image: Visual Studio 2017
-
-clone_folder: c:\gopath\src\github.com\urfave\cli
-
-environment:
-  GOPATH: C:\gopath
-  GOVERSION: 1.8.x
-  PYTHON: C:\Python36-x64
-  PYTHON_VERSION: 3.6.x
-  PYTHON_ARCH: 64
-
-install:
-- set PATH=%GOPATH%\bin;C:\go\bin;%PATH%
-- go version
-- go env
-- go get github.com/urfave/gfmrun/...
-- go get -v -t ./...
-
-build_script:
-- python runtests vet
-- python runtests test
-- python runtests gfmrun

+ 0 - 44
bashbrew/go/vendor/github.com/codegangsta/cli/category.go

@@ -1,44 +0,0 @@
-package cli
-
-// CommandCategories is a slice of *CommandCategory.
-type CommandCategories []*CommandCategory
-
-// CommandCategory is a category containing commands.
-type CommandCategory struct {
-	Name     string
-	Commands Commands
-}
-
-func (c CommandCategories) Less(i, j int) bool {
-	return c[i].Name < c[j].Name
-}
-
-func (c CommandCategories) Len() int {
-	return len(c)
-}
-
-func (c CommandCategories) Swap(i, j int) {
-	c[i], c[j] = c[j], c[i]
-}
-
-// AddCommand adds a command to a category.
-func (c CommandCategories) AddCommand(category string, command Command) CommandCategories {
-	for _, commandCategory := range c {
-		if commandCategory.Name == category {
-			commandCategory.Commands = append(commandCategory.Commands, command)
-			return c
-		}
-	}
-	return append(c, &CommandCategory{Name: category, Commands: []Command{command}})
-}
-
-// VisibleCommands returns a slice of the Commands with Hidden=false
-func (c *CommandCategory) VisibleCommands() []Command {
-	ret := []Command{}
-	for _, command := range c.Commands {
-		if !command.Hidden {
-			ret = append(ret, command)
-		}
-	}
-	return ret
-}

+ 0 - 22
bashbrew/go/vendor/github.com/codegangsta/cli/cli.go

@@ -1,22 +0,0 @@
-// Package cli provides a minimal framework for creating and organizing command line
-// Go applications. cli is designed to be easy to understand and write, the most simple
-// cli application can be written as follows:
-//   func main() {
-//     cli.NewApp().Run(os.Args)
-//   }
-//
-// Of course this application does not do much, so let's make this an actual application:
-//   func main() {
-//     app := cli.NewApp()
-//     app.Name = "greet"
-//     app.Usage = "say a greeting"
-//     app.Action = func(c *cli.Context) error {
-//       println("Greetings")
-//       return nil
-//     }
-//
-//     app.Run(os.Args)
-//   }
-package cli
-
-//go:generate python ./generate-flag-types cli -i flag-types.json -o flag_generated.go

+ 0 - 304
bashbrew/go/vendor/github.com/codegangsta/cli/command.go

@@ -1,304 +0,0 @@
-package cli
-
-import (
-	"fmt"
-	"io/ioutil"
-	"sort"
-	"strings"
-)
-
-// Command is a subcommand for a cli.App.
-type Command struct {
-	// The name of the command
-	Name string
-	// short name of the command. Typically one character (deprecated, use `Aliases`)
-	ShortName string
-	// A list of aliases for the command
-	Aliases []string
-	// A short description of the usage of this command
-	Usage string
-	// Custom text to show on USAGE section of help
-	UsageText string
-	// A longer explanation of how the command works
-	Description string
-	// A short description of the arguments of this command
-	ArgsUsage string
-	// The category the command is part of
-	Category string
-	// The function to call when checking for bash command completions
-	BashComplete BashCompleteFunc
-	// An action to execute before any sub-subcommands are run, but after the context is ready
-	// If a non-nil error is returned, no sub-subcommands are run
-	Before BeforeFunc
-	// An action to execute after any subcommands are run, but after the subcommand has finished
-	// It is run even if Action() panics
-	After AfterFunc
-	// The function to call when this command is invoked
-	Action interface{}
-	// TODO: replace `Action: interface{}` with `Action: ActionFunc` once some kind
-	// of deprecation period has passed, maybe?
-
-	// Execute this function if a usage error occurs.
-	OnUsageError OnUsageErrorFunc
-	// List of child commands
-	Subcommands Commands
-	// List of flags to parse
-	Flags []Flag
-	// Treat all flags as normal arguments if true
-	SkipFlagParsing bool
-	// Skip argument reordering which attempts to move flags before arguments,
-	// but only works if all flags appear after all arguments. This behavior was
-	// removed n version 2 since it only works under specific conditions so we
-	// backport here by exposing it as an option for compatibility.
-	SkipArgReorder bool
-	// Boolean to hide built-in help command
-	HideHelp bool
-	// Boolean to hide this command from help or completion
-	Hidden bool
-
-	// Full name of command for help, defaults to full command name, including parent commands.
-	HelpName        string
-	commandNamePath []string
-
-	// CustomHelpTemplate the text template for the command help topic.
-	// cli.go uses text/template to render templates. You can
-	// render custom help text by setting this variable.
-	CustomHelpTemplate string
-}
-
-type CommandsByName []Command
-
-func (c CommandsByName) Len() int {
-	return len(c)
-}
-
-func (c CommandsByName) Less(i, j int) bool {
-	return c[i].Name < c[j].Name
-}
-
-func (c CommandsByName) Swap(i, j int) {
-	c[i], c[j] = c[j], c[i]
-}
-
-// FullName returns the full name of the command.
-// For subcommands this ensures that parent commands are part of the command path
-func (c Command) FullName() string {
-	if c.commandNamePath == nil {
-		return c.Name
-	}
-	return strings.Join(c.commandNamePath, " ")
-}
-
-// Commands is a slice of Command
-type Commands []Command
-
-// Run invokes the command given the context, parses ctx.Args() to generate command-specific flags
-func (c Command) Run(ctx *Context) (err error) {
-	if len(c.Subcommands) > 0 {
-		return c.startApp(ctx)
-	}
-
-	if !c.HideHelp && (HelpFlag != BoolFlag{}) {
-		// append help to flags
-		c.Flags = append(
-			c.Flags,
-			HelpFlag,
-		)
-	}
-
-	set, err := flagSet(c.Name, c.Flags)
-	if err != nil {
-		return err
-	}
-	set.SetOutput(ioutil.Discard)
-
-	if c.SkipFlagParsing {
-		err = set.Parse(append([]string{"--"}, ctx.Args().Tail()...))
-	} else if !c.SkipArgReorder {
-		firstFlagIndex := -1
-		terminatorIndex := -1
-		for index, arg := range ctx.Args() {
-			if arg == "--" {
-				terminatorIndex = index
-				break
-			} else if arg == "-" {
-				// Do nothing. A dash alone is not really a flag.
-				continue
-			} else if strings.HasPrefix(arg, "-") && firstFlagIndex == -1 {
-				firstFlagIndex = index
-			}
-		}
-
-		if firstFlagIndex > -1 {
-			args := ctx.Args()
-			regularArgs := make([]string, len(args[1:firstFlagIndex]))
-			copy(regularArgs, args[1:firstFlagIndex])
-
-			var flagArgs []string
-			if terminatorIndex > -1 {
-				flagArgs = args[firstFlagIndex:terminatorIndex]
-				regularArgs = append(regularArgs, args[terminatorIndex:]...)
-			} else {
-				flagArgs = args[firstFlagIndex:]
-			}
-
-			err = set.Parse(append(flagArgs, regularArgs...))
-		} else {
-			err = set.Parse(ctx.Args().Tail())
-		}
-	} else {
-		err = set.Parse(ctx.Args().Tail())
-	}
-
-	nerr := normalizeFlags(c.Flags, set)
-	if nerr != nil {
-		fmt.Fprintln(ctx.App.Writer, nerr)
-		fmt.Fprintln(ctx.App.Writer)
-		ShowCommandHelp(ctx, c.Name)
-		return nerr
-	}
-
-	context := NewContext(ctx.App, set, ctx)
-	context.Command = c
-	if checkCommandCompletions(context, c.Name) {
-		return nil
-	}
-
-	if err != nil {
-		if c.OnUsageError != nil {
-			err := c.OnUsageError(context, err, false)
-			HandleExitCoder(err)
-			return err
-		}
-		fmt.Fprintln(context.App.Writer, "Incorrect Usage:", err.Error())
-		fmt.Fprintln(context.App.Writer)
-		ShowCommandHelp(context, c.Name)
-		return err
-	}
-
-	if checkCommandHelp(context, c.Name) {
-		return nil
-	}
-
-	if c.After != nil {
-		defer func() {
-			afterErr := c.After(context)
-			if afterErr != nil {
-				HandleExitCoder(err)
-				if err != nil {
-					err = NewMultiError(err, afterErr)
-				} else {
-					err = afterErr
-				}
-			}
-		}()
-	}
-
-	if c.Before != nil {
-		err = c.Before(context)
-		if err != nil {
-			ShowCommandHelp(context, c.Name)
-			HandleExitCoder(err)
-			return err
-		}
-	}
-
-	if c.Action == nil {
-		c.Action = helpSubcommand.Action
-	}
-
-	err = HandleAction(c.Action, context)
-
-	if err != nil {
-		HandleExitCoder(err)
-	}
-	return err
-}
-
-// Names returns the names including short names and aliases.
-func (c Command) Names() []string {
-	names := []string{c.Name}
-
-	if c.ShortName != "" {
-		names = append(names, c.ShortName)
-	}
-
-	return append(names, c.Aliases...)
-}
-
-// HasName returns true if Command.Name or Command.ShortName matches given name
-func (c Command) HasName(name string) bool {
-	for _, n := range c.Names() {
-		if n == name {
-			return true
-		}
-	}
-	return false
-}
-
-func (c Command) startApp(ctx *Context) error {
-	app := NewApp()
-	app.Metadata = ctx.App.Metadata
-	// set the name and usage
-	app.Name = fmt.Sprintf("%s %s", ctx.App.Name, c.Name)
-	if c.HelpName == "" {
-		app.HelpName = c.HelpName
-	} else {
-		app.HelpName = app.Name
-	}
-
-	app.Usage = c.Usage
-	app.Description = c.Description
-	app.ArgsUsage = c.ArgsUsage
-
-	// set CommandNotFound
-	app.CommandNotFound = ctx.App.CommandNotFound
-	app.CustomAppHelpTemplate = c.CustomHelpTemplate
-
-	// set the flags and commands
-	app.Commands = c.Subcommands
-	app.Flags = c.Flags
-	app.HideHelp = c.HideHelp
-
-	app.Version = ctx.App.Version
-	app.HideVersion = ctx.App.HideVersion
-	app.Compiled = ctx.App.Compiled
-	app.Author = ctx.App.Author
-	app.Email = ctx.App.Email
-	app.Writer = ctx.App.Writer
-	app.ErrWriter = ctx.App.ErrWriter
-
-	app.categories = CommandCategories{}
-	for _, command := range c.Subcommands {
-		app.categories = app.categories.AddCommand(command.Category, command)
-	}
-
-	sort.Sort(app.categories)
-
-	// bash completion
-	app.EnableBashCompletion = ctx.App.EnableBashCompletion
-	if c.BashComplete != nil {
-		app.BashComplete = c.BashComplete
-	}
-
-	// set the actions
-	app.Before = c.Before
-	app.After = c.After
-	if c.Action != nil {
-		app.Action = c.Action
-	} else {
-		app.Action = helpSubcommand.Action
-	}
-	app.OnUsageError = c.OnUsageError
-
-	for index, cc := range app.Commands {
-		app.Commands[index].commandNamePath = []string{c.Name, cc.Name}
-	}
-
-	return app.RunAsSubcommand(ctx)
-}
-
-// VisibleFlags returns a slice of the Flags with Hidden=false
-func (c Command) VisibleFlags() []Flag {
-	return visibleFlags(c.Flags)
-}

+ 0 - 278
bashbrew/go/vendor/github.com/codegangsta/cli/context.go

@@ -1,278 +0,0 @@
-package cli
-
-import (
-	"errors"
-	"flag"
-	"reflect"
-	"strings"
-	"syscall"
-)
-
-// Context is a type that is passed through to
-// each Handler action in a cli application. Context
-// can be used to retrieve context-specific Args and
-// parsed command-line options.
-type Context struct {
-	App           *App
-	Command       Command
-	shellComplete bool
-	flagSet       *flag.FlagSet
-	setFlags      map[string]bool
-	parentContext *Context
-}
-
-// NewContext creates a new context. For use in when invoking an App or Command action.
-func NewContext(app *App, set *flag.FlagSet, parentCtx *Context) *Context {
-	c := &Context{App: app, flagSet: set, parentContext: parentCtx}
-
-	if parentCtx != nil {
-		c.shellComplete = parentCtx.shellComplete
-	}
-
-	return c
-}
-
-// NumFlags returns the number of flags set
-func (c *Context) NumFlags() int {
-	return c.flagSet.NFlag()
-}
-
-// Set sets a context flag to a value.
-func (c *Context) Set(name, value string) error {
-	c.setFlags = nil
-	return c.flagSet.Set(name, value)
-}
-
-// GlobalSet sets a context flag to a value on the global flagset
-func (c *Context) GlobalSet(name, value string) error {
-	globalContext(c).setFlags = nil
-	return globalContext(c).flagSet.Set(name, value)
-}
-
-// IsSet determines if the flag was actually set
-func (c *Context) IsSet(name string) bool {
-	if c.setFlags == nil {
-		c.setFlags = make(map[string]bool)
-
-		c.flagSet.Visit(func(f *flag.Flag) {
-			c.setFlags[f.Name] = true
-		})
-
-		c.flagSet.VisitAll(func(f *flag.Flag) {
-			if _, ok := c.setFlags[f.Name]; ok {
-				return
-			}
-			c.setFlags[f.Name] = false
-		})
-
-		// XXX hack to support IsSet for flags with EnvVar
-		//
-		// There isn't an easy way to do this with the current implementation since
-		// whether a flag was set via an environment variable is very difficult to
-		// determine here. Instead, we intend to introduce a backwards incompatible
-		// change in version 2 to add `IsSet` to the Flag interface to push the
-		// responsibility closer to where the information required to determine
-		// whether a flag is set by non-standard means such as environment
-		// variables is avaliable.
-		//
-		// See https://github.com/urfave/cli/issues/294 for additional discussion
-		flags := c.Command.Flags
-		if c.Command.Name == "" { // cannot == Command{} since it contains slice types
-			if c.App != nil {
-				flags = c.App.Flags
-			}
-		}
-		for _, f := range flags {
-			eachName(f.GetName(), func(name string) {
-				if isSet, ok := c.setFlags[name]; isSet || !ok {
-					return
-				}
-
-				val := reflect.ValueOf(f)
-				if val.Kind() == reflect.Ptr {
-					val = val.Elem()
-				}
-
-				envVarValue := val.FieldByName("EnvVar")
-				if !envVarValue.IsValid() {
-					return
-				}
-
-				eachName(envVarValue.String(), func(envVar string) {
-					envVar = strings.TrimSpace(envVar)
-					if _, ok := syscall.Getenv(envVar); ok {
-						c.setFlags[name] = true
-						return
-					}
-				})
-			})
-		}
-	}
-
-	return c.setFlags[name]
-}
-
-// GlobalIsSet determines if the global flag was actually set
-func (c *Context) GlobalIsSet(name string) bool {
-	ctx := c
-	if ctx.parentContext != nil {
-		ctx = ctx.parentContext
-	}
-
-	for ; ctx != nil; ctx = ctx.parentContext {
-		if ctx.IsSet(name) {
-			return true
-		}
-	}
-	return false
-}
-
-// FlagNames returns a slice of flag names used in this context.
-func (c *Context) FlagNames() (names []string) {
-	for _, flag := range c.Command.Flags {
-		name := strings.Split(flag.GetName(), ",")[0]
-		if name == "help" {
-			continue
-		}
-		names = append(names, name)
-	}
-	return
-}
-
-// GlobalFlagNames returns a slice of global flag names used by the app.
-func (c *Context) GlobalFlagNames() (names []string) {
-	for _, flag := range c.App.Flags {
-		name := strings.Split(flag.GetName(), ",")[0]
-		if name == "help" || name == "version" {
-			continue
-		}
-		names = append(names, name)
-	}
-	return
-}
-
-// Parent returns the parent context, if any
-func (c *Context) Parent() *Context {
-	return c.parentContext
-}
-
-// value returns the value of the flag coressponding to `name`
-func (c *Context) value(name string) interface{} {
-	return c.flagSet.Lookup(name).Value.(flag.Getter).Get()
-}
-
-// Args contains apps console arguments
-type Args []string
-
-// Args returns the command line arguments associated with the context.
-func (c *Context) Args() Args {
-	args := Args(c.flagSet.Args())
-	return args
-}
-
-// NArg returns the number of the command line arguments.
-func (c *Context) NArg() int {
-	return len(c.Args())
-}
-
-// Get returns the nth argument, or else a blank string
-func (a Args) Get(n int) string {
-	if len(a) > n {
-		return a[n]
-	}
-	return ""
-}
-
-// First returns the first argument, or else a blank string
-func (a Args) First() string {
-	return a.Get(0)
-}
-
-// Tail returns the rest of the arguments (not the first one)
-// or else an empty string slice
-func (a Args) Tail() []string {
-	if len(a) >= 2 {
-		return []string(a)[1:]
-	}
-	return []string{}
-}
-
-// Present checks if there are any arguments present
-func (a Args) Present() bool {
-	return len(a) != 0
-}
-
-// Swap swaps arguments at the given indexes
-func (a Args) Swap(from, to int) error {
-	if from >= len(a) || to >= len(a) {
-		return errors.New("index out of range")
-	}
-	a[from], a[to] = a[to], a[from]
-	return nil
-}
-
-func globalContext(ctx *Context) *Context {
-	if ctx == nil {
-		return nil
-	}
-
-	for {
-		if ctx.parentContext == nil {
-			return ctx
-		}
-		ctx = ctx.parentContext
-	}
-}
-
-func lookupGlobalFlagSet(name string, ctx *Context) *flag.FlagSet {
-	if ctx.parentContext != nil {
-		ctx = ctx.parentContext
-	}
-	for ; ctx != nil; ctx = ctx.parentContext {
-		if f := ctx.flagSet.Lookup(name); f != nil {
-			return ctx.flagSet
-		}
-	}
-	return nil
-}
-
-func copyFlag(name string, ff *flag.Flag, set *flag.FlagSet) {
-	switch ff.Value.(type) {
-	case *StringSlice:
-	default:
-		set.Set(name, ff.Value.String())
-	}
-}
-
-func normalizeFlags(flags []Flag, set *flag.FlagSet) error {
-	visited := make(map[string]bool)
-	set.Visit(func(f *flag.Flag) {
-		visited[f.Name] = true
-	})
-	for _, f := range flags {
-		parts := strings.Split(f.GetName(), ",")
-		if len(parts) == 1 {
-			continue
-		}
-		var ff *flag.Flag
-		for _, name := range parts {
-			name = strings.Trim(name, " ")
-			if visited[name] {
-				if ff != nil {
-					return errors.New("Cannot use two forms of the same flag: " + name + " " + ff.Name)
-				}
-				ff = set.Lookup(name)
-			}
-		}
-		if ff == nil {
-			continue
-		}
-		for _, name := range parts {
-			name = strings.Trim(name, " ")
-			if !visited[name] {
-				copyFlag(name, ff, set)
-			}
-		}
-	}
-	return nil
-}

+ 0 - 115
bashbrew/go/vendor/github.com/codegangsta/cli/errors.go

@@ -1,115 +0,0 @@
-package cli
-
-import (
-	"fmt"
-	"io"
-	"os"
-	"strings"
-)
-
-// OsExiter is the function used when the app exits. If not set defaults to os.Exit.
-var OsExiter = os.Exit
-
-// ErrWriter is used to write errors to the user. This can be anything
-// implementing the io.Writer interface and defaults to os.Stderr.
-var ErrWriter io.Writer = os.Stderr
-
-// MultiError is an error that wraps multiple errors.
-type MultiError struct {
-	Errors []error
-}
-
-// NewMultiError creates a new MultiError. Pass in one or more errors.
-func NewMultiError(err ...error) MultiError {
-	return MultiError{Errors: err}
-}
-
-// Error implements the error interface.
-func (m MultiError) Error() string {
-	errs := make([]string, len(m.Errors))
-	for i, err := range m.Errors {
-		errs[i] = err.Error()
-	}
-
-	return strings.Join(errs, "\n")
-}
-
-type ErrorFormatter interface {
-	Format(s fmt.State, verb rune)
-}
-
-// ExitCoder is the interface checked by `App` and `Command` for a custom exit
-// code
-type ExitCoder interface {
-	error
-	ExitCode() int
-}
-
-// ExitError fulfills both the builtin `error` interface and `ExitCoder`
-type ExitError struct {
-	exitCode int
-	message  interface{}
-}
-
-// NewExitError makes a new *ExitError
-func NewExitError(message interface{}, exitCode int) *ExitError {
-	return &ExitError{
-		exitCode: exitCode,
-		message:  message,
-	}
-}
-
-// Error returns the string message, fulfilling the interface required by
-// `error`
-func (ee *ExitError) Error() string {
-	return fmt.Sprintf("%v", ee.message)
-}
-
-// ExitCode returns the exit code, fulfilling the interface required by
-// `ExitCoder`
-func (ee *ExitError) ExitCode() int {
-	return ee.exitCode
-}
-
-// HandleExitCoder checks if the error fulfills the ExitCoder interface, and if
-// so prints the error to stderr (if it is non-empty) and calls OsExiter with the
-// given exit code.  If the given error is a MultiError, then this func is
-// called on all members of the Errors slice and calls OsExiter with the last exit code.
-func HandleExitCoder(err error) {
-	if err == nil {
-		return
-	}
-
-	if exitErr, ok := err.(ExitCoder); ok {
-		if err.Error() != "" {
-			if _, ok := exitErr.(ErrorFormatter); ok {
-				fmt.Fprintf(ErrWriter, "%+v\n", err)
-			} else {
-				fmt.Fprintln(ErrWriter, err)
-			}
-		}
-		OsExiter(exitErr.ExitCode())
-		return
-	}
-
-	if multiErr, ok := err.(MultiError); ok {
-		code := handleMultiError(multiErr)
-		OsExiter(code)
-		return
-	}
-}
-
-func handleMultiError(multiErr MultiError) int {
-	code := 1
-	for _, merr := range multiErr.Errors {
-		if multiErr2, ok := merr.(MultiError); ok {
-			code = handleMultiError(multiErr2)
-		} else {
-			fmt.Fprintln(ErrWriter, merr)
-			if exitErr, ok := merr.(ExitCoder); ok {
-				code = exitErr.ExitCode()
-			}
-		}
-	}
-	return code
-}

+ 0 - 93
bashbrew/go/vendor/github.com/codegangsta/cli/flag-types.json

@@ -1,93 +0,0 @@
-[
-  {
-    "name": "Bool",
-    "type": "bool",
-    "value": false,
-    "context_default": "false",
-    "parser": "strconv.ParseBool(f.Value.String())"
-  },
-  {
-    "name": "BoolT",
-    "type": "bool",
-    "value": false,
-    "doctail": " that is true by default",
-    "context_default": "false",
-    "parser": "strconv.ParseBool(f.Value.String())"
-  },
-  {
-    "name": "Duration",
-    "type": "time.Duration",
-    "doctail": " (see https://golang.org/pkg/time/#ParseDuration)",
-    "context_default": "0",
-    "parser": "time.ParseDuration(f.Value.String())"
-  },
-  {
-    "name": "Float64",
-    "type": "float64",
-    "context_default": "0",
-    "parser": "strconv.ParseFloat(f.Value.String(), 64)"
-  },
-  {
-    "name": "Generic",
-    "type": "Generic",
-    "dest": false,
-    "context_default": "nil",
-    "context_type": "interface{}"
-  },
-  {
-    "name": "Int64",
-    "type": "int64",
-    "context_default": "0",
-    "parser": "strconv.ParseInt(f.Value.String(), 0, 64)"
-  },
-  {
-    "name": "Int",
-    "type": "int",
-    "context_default": "0",
-    "parser": "strconv.ParseInt(f.Value.String(), 0, 64)",
-    "parser_cast": "int(parsed)"
-  },
-  {
-    "name": "IntSlice",
-    "type": "*IntSlice",
-    "dest": false,
-    "context_default": "nil",
-    "context_type": "[]int",
-    "parser": "(f.Value.(*IntSlice)).Value(), error(nil)"
-  },
-  {
-    "name": "Int64Slice",
-    "type": "*Int64Slice",
-    "dest": false,
-    "context_default": "nil",
-    "context_type": "[]int64",
-    "parser": "(f.Value.(*Int64Slice)).Value(), error(nil)"
-  },
-  {
-    "name": "String",
-    "type": "string",
-    "context_default": "\"\"",
-    "parser": "f.Value.String(), error(nil)"
-  },
-  {
-    "name": "StringSlice",
-    "type": "*StringSlice",
-    "dest": false,
-    "context_default": "nil",
-    "context_type": "[]string",
-    "parser": "(f.Value.(*StringSlice)).Value(), error(nil)"
-  },
-  {
-    "name": "Uint64",
-    "type": "uint64",
-    "context_default": "0",
-    "parser": "strconv.ParseUint(f.Value.String(), 0, 64)"
-  },
-  {
-    "name": "Uint",
-    "type": "uint",
-    "context_default": "0",
-    "parser": "strconv.ParseUint(f.Value.String(), 0, 64)",
-    "parser_cast": "uint(parsed)"
-  }
-]

+ 0 - 799
bashbrew/go/vendor/github.com/codegangsta/cli/flag.go

@@ -1,799 +0,0 @@
-package cli
-
-import (
-	"flag"
-	"fmt"
-	"reflect"
-	"runtime"
-	"strconv"
-	"strings"
-	"syscall"
-	"time"
-)
-
-const defaultPlaceholder = "value"
-
-// BashCompletionFlag enables bash-completion for all commands and subcommands
-var BashCompletionFlag Flag = BoolFlag{
-	Name:   "generate-bash-completion",
-	Hidden: true,
-}
-
-// VersionFlag prints the version for the application
-var VersionFlag Flag = BoolFlag{
-	Name:  "version, v",
-	Usage: "print the version",
-}
-
-// HelpFlag prints the help for all commands and subcommands
-// Set to the zero value (BoolFlag{}) to disable flag -- keeps subcommand
-// unless HideHelp is set to true)
-var HelpFlag Flag = BoolFlag{
-	Name:  "help, h",
-	Usage: "show help",
-}
-
-// FlagStringer converts a flag definition to a string. This is used by help
-// to display a flag.
-var FlagStringer FlagStringFunc = stringifyFlag
-
-// FlagsByName is a slice of Flag.
-type FlagsByName []Flag
-
-func (f FlagsByName) Len() int {
-	return len(f)
-}
-
-func (f FlagsByName) Less(i, j int) bool {
-	return f[i].GetName() < f[j].GetName()
-}
-
-func (f FlagsByName) Swap(i, j int) {
-	f[i], f[j] = f[j], f[i]
-}
-
-// Flag is a common interface related to parsing flags in cli.
-// For more advanced flag parsing techniques, it is recommended that
-// this interface be implemented.
-type Flag interface {
-	fmt.Stringer
-	// Apply Flag settings to the given flag set
-	Apply(*flag.FlagSet)
-	GetName() string
-}
-
-// errorableFlag is an interface that allows us to return errors during apply
-// it allows flags defined in this library to return errors in a fashion backwards compatible
-// TODO remove in v2 and modify the existing Flag interface to return errors
-type errorableFlag interface {
-	Flag
-
-	ApplyWithError(*flag.FlagSet) error
-}
-
-func flagSet(name string, flags []Flag) (*flag.FlagSet, error) {
-	set := flag.NewFlagSet(name, flag.ContinueOnError)
-
-	for _, f := range flags {
-		//TODO remove in v2 when errorableFlag is removed
-		if ef, ok := f.(errorableFlag); ok {
-			if err := ef.ApplyWithError(set); err != nil {
-				return nil, err
-			}
-		} else {
-			f.Apply(set)
-		}
-	}
-	return set, nil
-}
-
-func eachName(longName string, fn func(string)) {
-	parts := strings.Split(longName, ",")
-	for _, name := range parts {
-		name = strings.Trim(name, " ")
-		fn(name)
-	}
-}
-
-// Generic is a generic parseable type identified by a specific flag
-type Generic interface {
-	Set(value string) error
-	String() string
-}
-
-// Apply takes the flagset and calls Set on the generic flag with the value
-// provided by the user for parsing by the flag
-// Ignores parsing errors
-func (f GenericFlag) Apply(set *flag.FlagSet) {
-	f.ApplyWithError(set)
-}
-
-// ApplyWithError takes the flagset and calls Set on the generic flag with the value
-// provided by the user for parsing by the flag
-func (f GenericFlag) ApplyWithError(set *flag.FlagSet) error {
-	val := f.Value
-	if f.EnvVar != "" {
-		for _, envVar := range strings.Split(f.EnvVar, ",") {
-			envVar = strings.TrimSpace(envVar)
-			if envVal, ok := syscall.Getenv(envVar); ok {
-				if err := val.Set(envVal); err != nil {
-					return fmt.Errorf("could not parse %s as value for flag %s: %s", envVal, f.Name, err)
-				}
-				break
-			}
-		}
-	}
-
-	eachName(f.Name, func(name string) {
-		set.Var(f.Value, name, f.Usage)
-	})
-
-	return nil
-}
-
-// StringSlice is an opaque type for []string to satisfy flag.Value and flag.Getter
-type StringSlice []string
-
-// Set appends the string value to the list of values
-func (f *StringSlice) Set(value string) error {
-	*f = append(*f, value)
-	return nil
-}
-
-// String returns a readable representation of this value (for usage defaults)
-func (f *StringSlice) String() string {
-	return fmt.Sprintf("%s", *f)
-}
-
-// Value returns the slice of strings set by this flag
-func (f *StringSlice) Value() []string {
-	return *f
-}
-
-// Get returns the slice of strings set by this flag
-func (f *StringSlice) Get() interface{} {
-	return *f
-}
-
-// Apply populates the flag given the flag set and environment
-// Ignores errors
-func (f StringSliceFlag) Apply(set *flag.FlagSet) {
-	f.ApplyWithError(set)
-}
-
-// ApplyWithError populates the flag given the flag set and environment
-func (f StringSliceFlag) ApplyWithError(set *flag.FlagSet) error {
-	if f.EnvVar != "" {
-		for _, envVar := range strings.Split(f.EnvVar, ",") {
-			envVar = strings.TrimSpace(envVar)
-			if envVal, ok := syscall.Getenv(envVar); ok {
-				newVal := &StringSlice{}
-				for _, s := range strings.Split(envVal, ",") {
-					s = strings.TrimSpace(s)
-					if err := newVal.Set(s); err != nil {
-						return fmt.Errorf("could not parse %s as string value for flag %s: %s", envVal, f.Name, err)
-					}
-				}
-				f.Value = newVal
-				break
-			}
-		}
-	}
-
-	eachName(f.Name, func(name string) {
-		if f.Value == nil {
-			f.Value = &StringSlice{}
-		}
-		set.Var(f.Value, name, f.Usage)
-	})
-
-	return nil
-}
-
-// IntSlice is an opaque type for []int to satisfy flag.Value and flag.Getter
-type IntSlice []int
-
-// Set parses the value into an integer and appends it to the list of values
-func (f *IntSlice) Set(value string) error {
-	tmp, err := strconv.Atoi(value)
-	if err != nil {
-		return err
-	}
-	*f = append(*f, tmp)
-	return nil
-}
-
-// String returns a readable representation of this value (for usage defaults)
-func (f *IntSlice) String() string {
-	return fmt.Sprintf("%#v", *f)
-}
-
-// Value returns the slice of ints set by this flag
-func (f *IntSlice) Value() []int {
-	return *f
-}
-
-// Get returns the slice of ints set by this flag
-func (f *IntSlice) Get() interface{} {
-	return *f
-}
-
-// Apply populates the flag given the flag set and environment
-// Ignores errors
-func (f IntSliceFlag) Apply(set *flag.FlagSet) {
-	f.ApplyWithError(set)
-}
-
-// ApplyWithError populates the flag given the flag set and environment
-func (f IntSliceFlag) ApplyWithError(set *flag.FlagSet) error {
-	if f.EnvVar != "" {
-		for _, envVar := range strings.Split(f.EnvVar, ",") {
-			envVar = strings.TrimSpace(envVar)
-			if envVal, ok := syscall.Getenv(envVar); ok {
-				newVal := &IntSlice{}
-				for _, s := range strings.Split(envVal, ",") {
-					s = strings.TrimSpace(s)
-					if err := newVal.Set(s); err != nil {
-						return fmt.Errorf("could not parse %s as int slice value for flag %s: %s", envVal, f.Name, err)
-					}
-				}
-				f.Value = newVal
-				break
-			}
-		}
-	}
-
-	eachName(f.Name, func(name string) {
-		if f.Value == nil {
-			f.Value = &IntSlice{}
-		}
-		set.Var(f.Value, name, f.Usage)
-	})
-
-	return nil
-}
-
-// Int64Slice is an opaque type for []int to satisfy flag.Value and flag.Getter
-type Int64Slice []int64
-
-// Set parses the value into an integer and appends it to the list of values
-func (f *Int64Slice) Set(value string) error {
-	tmp, err := strconv.ParseInt(value, 10, 64)
-	if err != nil {
-		return err
-	}
-	*f = append(*f, tmp)
-	return nil
-}
-
-// String returns a readable representation of this value (for usage defaults)
-func (f *Int64Slice) String() string {
-	return fmt.Sprintf("%#v", *f)
-}
-
-// Value returns the slice of ints set by this flag
-func (f *Int64Slice) Value() []int64 {
-	return *f
-}
-
-// Get returns the slice of ints set by this flag
-func (f *Int64Slice) Get() interface{} {
-	return *f
-}
-
-// Apply populates the flag given the flag set and environment
-// Ignores errors
-func (f Int64SliceFlag) Apply(set *flag.FlagSet) {
-	f.ApplyWithError(set)
-}
-
-// ApplyWithError populates the flag given the flag set and environment
-func (f Int64SliceFlag) ApplyWithError(set *flag.FlagSet) error {
-	if f.EnvVar != "" {
-		for _, envVar := range strings.Split(f.EnvVar, ",") {
-			envVar = strings.TrimSpace(envVar)
-			if envVal, ok := syscall.Getenv(envVar); ok {
-				newVal := &Int64Slice{}
-				for _, s := range strings.Split(envVal, ",") {
-					s = strings.TrimSpace(s)
-					if err := newVal.Set(s); err != nil {
-						return fmt.Errorf("could not parse %s as int64 slice value for flag %s: %s", envVal, f.Name, err)
-					}
-				}
-				f.Value = newVal
-				break
-			}
-		}
-	}
-
-	eachName(f.Name, func(name string) {
-		if f.Value == nil {
-			f.Value = &Int64Slice{}
-		}
-		set.Var(f.Value, name, f.Usage)
-	})
-	return nil
-}
-
-// Apply populates the flag given the flag set and environment
-// Ignores errors
-func (f BoolFlag) Apply(set *flag.FlagSet) {
-	f.ApplyWithError(set)
-}
-
-// ApplyWithError populates the flag given the flag set and environment
-func (f BoolFlag) ApplyWithError(set *flag.FlagSet) error {
-	val := false
-	if f.EnvVar != "" {
-		for _, envVar := range strings.Split(f.EnvVar, ",") {
-			envVar = strings.TrimSpace(envVar)
-			if envVal, ok := syscall.Getenv(envVar); ok {
-				if envVal == "" {
-					val = false
-					break
-				}
-
-				envValBool, err := strconv.ParseBool(envVal)
-				if err != nil {
-					return fmt.Errorf("could not parse %s as bool value for flag %s: %s", envVal, f.Name, err)
-				}
-
-				val = envValBool
-				break
-			}
-		}
-	}
-
-	eachName(f.Name, func(name string) {
-		if f.Destination != nil {
-			set.BoolVar(f.Destination, name, val, f.Usage)
-			return
-		}
-		set.Bool(name, val, f.Usage)
-	})
-
-	return nil
-}
-
-// Apply populates the flag given the flag set and environment
-// Ignores errors
-func (f BoolTFlag) Apply(set *flag.FlagSet) {
-	f.ApplyWithError(set)
-}
-
-// ApplyWithError populates the flag given the flag set and environment
-func (f BoolTFlag) ApplyWithError(set *flag.FlagSet) error {
-	val := true
-	if f.EnvVar != "" {
-		for _, envVar := range strings.Split(f.EnvVar, ",") {
-			envVar = strings.TrimSpace(envVar)
-			if envVal, ok := syscall.Getenv(envVar); ok {
-				if envVal == "" {
-					val = false
-					break
-				}
-
-				envValBool, err := strconv.ParseBool(envVal)
-				if err != nil {
-					return fmt.Errorf("could not parse %s as bool value for flag %s: %s", envVal, f.Name, err)
-				}
-
-				val = envValBool
-				break
-			}
-		}
-	}
-
-	eachName(f.Name, func(name string) {
-		if f.Destination != nil {
-			set.BoolVar(f.Destination, name, val, f.Usage)
-			return
-		}
-		set.Bool(name, val, f.Usage)
-	})
-
-	return nil
-}
-
-// Apply populates the flag given the flag set and environment
-// Ignores errors
-func (f StringFlag) Apply(set *flag.FlagSet) {
-	f.ApplyWithError(set)
-}
-
-// ApplyWithError populates the flag given the flag set and environment
-func (f StringFlag) ApplyWithError(set *flag.FlagSet) error {
-	if f.EnvVar != "" {
-		for _, envVar := range strings.Split(f.EnvVar, ",") {
-			envVar = strings.TrimSpace(envVar)
-			if envVal, ok := syscall.Getenv(envVar); ok {
-				f.Value = envVal
-				break
-			}
-		}
-	}
-
-	eachName(f.Name, func(name string) {
-		if f.Destination != nil {
-			set.StringVar(f.Destination, name, f.Value, f.Usage)
-			return
-		}
-		set.String(name, f.Value, f.Usage)
-	})
-
-	return nil
-}
-
-// Apply populates the flag given the flag set and environment
-// Ignores errors
-func (f IntFlag) Apply(set *flag.FlagSet) {
-	f.ApplyWithError(set)
-}
-
-// ApplyWithError populates the flag given the flag set and environment
-func (f IntFlag) ApplyWithError(set *flag.FlagSet) error {
-	if f.EnvVar != "" {
-		for _, envVar := range strings.Split(f.EnvVar, ",") {
-			envVar = strings.TrimSpace(envVar)
-			if envVal, ok := syscall.Getenv(envVar); ok {
-				envValInt, err := strconv.ParseInt(envVal, 0, 64)
-				if err != nil {
-					return fmt.Errorf("could not parse %s as int value for flag %s: %s", envVal, f.Name, err)
-				}
-				f.Value = int(envValInt)
-				break
-			}
-		}
-	}
-
-	eachName(f.Name, func(name string) {
-		if f.Destination != nil {
-			set.IntVar(f.Destination, name, f.Value, f.Usage)
-			return
-		}
-		set.Int(name, f.Value, f.Usage)
-	})
-
-	return nil
-}
-
-// Apply populates the flag given the flag set and environment
-// Ignores errors
-func (f Int64Flag) Apply(set *flag.FlagSet) {
-	f.ApplyWithError(set)
-}
-
-// ApplyWithError populates the flag given the flag set and environment
-func (f Int64Flag) ApplyWithError(set *flag.FlagSet) error {
-	if f.EnvVar != "" {
-		for _, envVar := range strings.Split(f.EnvVar, ",") {
-			envVar = strings.TrimSpace(envVar)
-			if envVal, ok := syscall.Getenv(envVar); ok {
-				envValInt, err := strconv.ParseInt(envVal, 0, 64)
-				if err != nil {
-					return fmt.Errorf("could not parse %s as int value for flag %s: %s", envVal, f.Name, err)
-				}
-
-				f.Value = envValInt
-				break
-			}
-		}
-	}
-
-	eachName(f.Name, func(name string) {
-		if f.Destination != nil {
-			set.Int64Var(f.Destination, name, f.Value, f.Usage)
-			return
-		}
-		set.Int64(name, f.Value, f.Usage)
-	})
-
-	return nil
-}
-
-// Apply populates the flag given the flag set and environment
-// Ignores errors
-func (f UintFlag) Apply(set *flag.FlagSet) {
-	f.ApplyWithError(set)
-}
-
-// ApplyWithError populates the flag given the flag set and environment
-func (f UintFlag) ApplyWithError(set *flag.FlagSet) error {
-	if f.EnvVar != "" {
-		for _, envVar := range strings.Split(f.EnvVar, ",") {
-			envVar = strings.TrimSpace(envVar)
-			if envVal, ok := syscall.Getenv(envVar); ok {
-				envValInt, err := strconv.ParseUint(envVal, 0, 64)
-				if err != nil {
-					return fmt.Errorf("could not parse %s as uint value for flag %s: %s", envVal, f.Name, err)
-				}
-
-				f.Value = uint(envValInt)
-				break
-			}
-		}
-	}
-
-	eachName(f.Name, func(name string) {
-		if f.Destination != nil {
-			set.UintVar(f.Destination, name, f.Value, f.Usage)
-			return
-		}
-		set.Uint(name, f.Value, f.Usage)
-	})
-
-	return nil
-}
-
-// Apply populates the flag given the flag set and environment
-// Ignores errors
-func (f Uint64Flag) Apply(set *flag.FlagSet) {
-	f.ApplyWithError(set)
-}
-
-// ApplyWithError populates the flag given the flag set and environment
-func (f Uint64Flag) ApplyWithError(set *flag.FlagSet) error {
-	if f.EnvVar != "" {
-		for _, envVar := range strings.Split(f.EnvVar, ",") {
-			envVar = strings.TrimSpace(envVar)
-			if envVal, ok := syscall.Getenv(envVar); ok {
-				envValInt, err := strconv.ParseUint(envVal, 0, 64)
-				if err != nil {
-					return fmt.Errorf("could not parse %s as uint64 value for flag %s: %s", envVal, f.Name, err)
-				}
-
-				f.Value = uint64(envValInt)
-				break
-			}
-		}
-	}
-
-	eachName(f.Name, func(name string) {
-		if f.Destination != nil {
-			set.Uint64Var(f.Destination, name, f.Value, f.Usage)
-			return
-		}
-		set.Uint64(name, f.Value, f.Usage)
-	})
-
-	return nil
-}
-
-// Apply populates the flag given the flag set and environment
-// Ignores errors
-func (f DurationFlag) Apply(set *flag.FlagSet) {
-	f.ApplyWithError(set)
-}
-
-// ApplyWithError populates the flag given the flag set and environment
-func (f DurationFlag) ApplyWithError(set *flag.FlagSet) error {
-	if f.EnvVar != "" {
-		for _, envVar := range strings.Split(f.EnvVar, ",") {
-			envVar = strings.TrimSpace(envVar)
-			if envVal, ok := syscall.Getenv(envVar); ok {
-				envValDuration, err := time.ParseDuration(envVal)
-				if err != nil {
-					return fmt.Errorf("could not parse %s as duration for flag %s: %s", envVal, f.Name, err)
-				}
-
-				f.Value = envValDuration
-				break
-			}
-		}
-	}
-
-	eachName(f.Name, func(name string) {
-		if f.Destination != nil {
-			set.DurationVar(f.Destination, name, f.Value, f.Usage)
-			return
-		}
-		set.Duration(name, f.Value, f.Usage)
-	})
-
-	return nil
-}
-
-// Apply populates the flag given the flag set and environment
-// Ignores errors
-func (f Float64Flag) Apply(set *flag.FlagSet) {
-	f.ApplyWithError(set)
-}
-
-// ApplyWithError populates the flag given the flag set and environment
-func (f Float64Flag) ApplyWithError(set *flag.FlagSet) error {
-	if f.EnvVar != "" {
-		for _, envVar := range strings.Split(f.EnvVar, ",") {
-			envVar = strings.TrimSpace(envVar)
-			if envVal, ok := syscall.Getenv(envVar); ok {
-				envValFloat, err := strconv.ParseFloat(envVal, 10)
-				if err != nil {
-					return fmt.Errorf("could not parse %s as float64 value for flag %s: %s", envVal, f.Name, err)
-				}
-
-				f.Value = float64(envValFloat)
-				break
-			}
-		}
-	}
-
-	eachName(f.Name, func(name string) {
-		if f.Destination != nil {
-			set.Float64Var(f.Destination, name, f.Value, f.Usage)
-			return
-		}
-		set.Float64(name, f.Value, f.Usage)
-	})
-
-	return nil
-}
-
-func visibleFlags(fl []Flag) []Flag {
-	visible := []Flag{}
-	for _, flag := range fl {
-		field := flagValue(flag).FieldByName("Hidden")
-		if !field.IsValid() || !field.Bool() {
-			visible = append(visible, flag)
-		}
-	}
-	return visible
-}
-
-func prefixFor(name string) (prefix string) {
-	if len(name) == 1 {
-		prefix = "-"
-	} else {
-		prefix = "--"
-	}
-
-	return
-}
-
-// Returns the placeholder, if any, and the unquoted usage string.
-func unquoteUsage(usage string) (string, string) {
-	for i := 0; i < len(usage); i++ {
-		if usage[i] == '`' {
-			for j := i + 1; j < len(usage); j++ {
-				if usage[j] == '`' {
-					name := usage[i+1 : j]
-					usage = usage[:i] + name + usage[j+1:]
-					return name, usage
-				}
-			}
-			break
-		}
-	}
-	return "", usage
-}
-
-func prefixedNames(fullName, placeholder string) string {
-	var prefixed string
-	parts := strings.Split(fullName, ",")
-	for i, name := range parts {
-		name = strings.Trim(name, " ")
-		prefixed += prefixFor(name) + name
-		if placeholder != "" {
-			prefixed += " " + placeholder
-		}
-		if i < len(parts)-1 {
-			prefixed += ", "
-		}
-	}
-	return prefixed
-}
-
-func withEnvHint(envVar, str string) string {
-	envText := ""
-	if envVar != "" {
-		prefix := "$"
-		suffix := ""
-		sep := ", $"
-		if runtime.GOOS == "windows" {
-			prefix = "%"
-			suffix = "%"
-			sep = "%, %"
-		}
-		envText = fmt.Sprintf(" [%s%s%s]", prefix, strings.Join(strings.Split(envVar, ","), sep), suffix)
-	}
-	return str + envText
-}
-
-func flagValue(f Flag) reflect.Value {
-	fv := reflect.ValueOf(f)
-	for fv.Kind() == reflect.Ptr {
-		fv = reflect.Indirect(fv)
-	}
-	return fv
-}
-
-func stringifyFlag(f Flag) string {
-	fv := flagValue(f)
-
-	switch f.(type) {
-	case IntSliceFlag:
-		return withEnvHint(fv.FieldByName("EnvVar").String(),
-			stringifyIntSliceFlag(f.(IntSliceFlag)))
-	case Int64SliceFlag:
-		return withEnvHint(fv.FieldByName("EnvVar").String(),
-			stringifyInt64SliceFlag(f.(Int64SliceFlag)))
-	case StringSliceFlag:
-		return withEnvHint(fv.FieldByName("EnvVar").String(),
-			stringifyStringSliceFlag(f.(StringSliceFlag)))
-	}
-
-	placeholder, usage := unquoteUsage(fv.FieldByName("Usage").String())
-
-	needsPlaceholder := false
-	defaultValueString := ""
-
-	if val := fv.FieldByName("Value"); val.IsValid() {
-		needsPlaceholder = true
-		defaultValueString = fmt.Sprintf(" (default: %v)", val.Interface())
-
-		if val.Kind() == reflect.String && val.String() != "" {
-			defaultValueString = fmt.Sprintf(" (default: %q)", val.String())
-		}
-	}
-
-	if defaultValueString == " (default: )" {
-		defaultValueString = ""
-	}
-
-	if needsPlaceholder && placeholder == "" {
-		placeholder = defaultPlaceholder
-	}
-
-	usageWithDefault := strings.TrimSpace(fmt.Sprintf("%s%s", usage, defaultValueString))
-
-	return withEnvHint(fv.FieldByName("EnvVar").String(),
-		fmt.Sprintf("%s\t%s", prefixedNames(fv.FieldByName("Name").String(), placeholder), usageWithDefault))
-}
-
-func stringifyIntSliceFlag(f IntSliceFlag) string {
-	defaultVals := []string{}
-	if f.Value != nil && len(f.Value.Value()) > 0 {
-		for _, i := range f.Value.Value() {
-			defaultVals = append(defaultVals, fmt.Sprintf("%d", i))
-		}
-	}
-
-	return stringifySliceFlag(f.Usage, f.Name, defaultVals)
-}
-
-func stringifyInt64SliceFlag(f Int64SliceFlag) string {
-	defaultVals := []string{}
-	if f.Value != nil && len(f.Value.Value()) > 0 {
-		for _, i := range f.Value.Value() {
-			defaultVals = append(defaultVals, fmt.Sprintf("%d", i))
-		}
-	}
-
-	return stringifySliceFlag(f.Usage, f.Name, defaultVals)
-}
-
-func stringifyStringSliceFlag(f StringSliceFlag) string {
-	defaultVals := []string{}
-	if f.Value != nil && len(f.Value.Value()) > 0 {
-		for _, s := range f.Value.Value() {
-			if len(s) > 0 {
-				defaultVals = append(defaultVals, fmt.Sprintf("%q", s))
-			}
-		}
-	}
-
-	return stringifySliceFlag(f.Usage, f.Name, defaultVals)
-}
-
-func stringifySliceFlag(usage, name string, defaultVals []string) string {
-	placeholder, usage := unquoteUsage(usage)
-	if placeholder == "" {
-		placeholder = defaultPlaceholder
-	}
-
-	defaultVal := ""
-	if len(defaultVals) > 0 {
-		defaultVal = fmt.Sprintf(" (default: %s)", strings.Join(defaultVals, ", "))
-	}
-
-	usageWithDefault := strings.TrimSpace(fmt.Sprintf("%s%s", usage, defaultVal))
-	return fmt.Sprintf("%s\t%s", prefixedNames(name, placeholder), usageWithDefault)
-}

+ 0 - 627
bashbrew/go/vendor/github.com/codegangsta/cli/flag_generated.go

@@ -1,627 +0,0 @@
-package cli
-
-import (
-	"flag"
-	"strconv"
-	"time"
-)
-
-// WARNING: This file is generated!
-
-// BoolFlag is a flag with type bool
-type BoolFlag struct {
-	Name        string
-	Usage       string
-	EnvVar      string
-	Hidden      bool
-	Destination *bool
-}
-
-// String returns a readable representation of this value
-// (for usage defaults)
-func (f BoolFlag) String() string {
-	return FlagStringer(f)
-}
-
-// GetName returns the name of the flag
-func (f BoolFlag) GetName() string {
-	return f.Name
-}
-
-// Bool looks up the value of a local BoolFlag, returns
-// false if not found
-func (c *Context) Bool(name string) bool {
-	return lookupBool(name, c.flagSet)
-}
-
-// GlobalBool looks up the value of a global BoolFlag, returns
-// false if not found
-func (c *Context) GlobalBool(name string) bool {
-	if fs := lookupGlobalFlagSet(name, c); fs != nil {
-		return lookupBool(name, fs)
-	}
-	return false
-}
-
-func lookupBool(name string, set *flag.FlagSet) bool {
-	f := set.Lookup(name)
-	if f != nil {
-		parsed, err := strconv.ParseBool(f.Value.String())
-		if err != nil {
-			return false
-		}
-		return parsed
-	}
-	return false
-}
-
-// BoolTFlag is a flag with type bool that is true by default
-type BoolTFlag struct {
-	Name        string
-	Usage       string
-	EnvVar      string
-	Hidden      bool
-	Destination *bool
-}
-
-// String returns a readable representation of this value
-// (for usage defaults)
-func (f BoolTFlag) String() string {
-	return FlagStringer(f)
-}
-
-// GetName returns the name of the flag
-func (f BoolTFlag) GetName() string {
-	return f.Name
-}
-
-// BoolT looks up the value of a local BoolTFlag, returns
-// false if not found
-func (c *Context) BoolT(name string) bool {
-	return lookupBoolT(name, c.flagSet)
-}
-
-// GlobalBoolT looks up the value of a global BoolTFlag, returns
-// false if not found
-func (c *Context) GlobalBoolT(name string) bool {
-	if fs := lookupGlobalFlagSet(name, c); fs != nil {
-		return lookupBoolT(name, fs)
-	}
-	return false
-}
-
-func lookupBoolT(name string, set *flag.FlagSet) bool {
-	f := set.Lookup(name)
-	if f != nil {
-		parsed, err := strconv.ParseBool(f.Value.String())
-		if err != nil {
-			return false
-		}
-		return parsed
-	}
-	return false
-}
-
-// DurationFlag is a flag with type time.Duration (see https://golang.org/pkg/time/#ParseDuration)
-type DurationFlag struct {
-	Name        string
-	Usage       string
-	EnvVar      string
-	Hidden      bool
-	Value       time.Duration
-	Destination *time.Duration
-}
-
-// String returns a readable representation of this value
-// (for usage defaults)
-func (f DurationFlag) String() string {
-	return FlagStringer(f)
-}
-
-// GetName returns the name of the flag
-func (f DurationFlag) GetName() string {
-	return f.Name
-}
-
-// Duration looks up the value of a local DurationFlag, returns
-// 0 if not found
-func (c *Context) Duration(name string) time.Duration {
-	return lookupDuration(name, c.flagSet)
-}
-
-// GlobalDuration looks up the value of a global DurationFlag, returns
-// 0 if not found
-func (c *Context) GlobalDuration(name string) time.Duration {
-	if fs := lookupGlobalFlagSet(name, c); fs != nil {
-		return lookupDuration(name, fs)
-	}
-	return 0
-}
-
-func lookupDuration(name string, set *flag.FlagSet) time.Duration {
-	f := set.Lookup(name)
-	if f != nil {
-		parsed, err := time.ParseDuration(f.Value.String())
-		if err != nil {
-			return 0
-		}
-		return parsed
-	}
-	return 0
-}
-
-// Float64Flag is a flag with type float64
-type Float64Flag struct {
-	Name        string
-	Usage       string
-	EnvVar      string
-	Hidden      bool
-	Value       float64
-	Destination *float64
-}
-
-// String returns a readable representation of this value
-// (for usage defaults)
-func (f Float64Flag) String() string {
-	return FlagStringer(f)
-}
-
-// GetName returns the name of the flag
-func (f Float64Flag) GetName() string {
-	return f.Name
-}
-
-// Float64 looks up the value of a local Float64Flag, returns
-// 0 if not found
-func (c *Context) Float64(name string) float64 {
-	return lookupFloat64(name, c.flagSet)
-}
-
-// GlobalFloat64 looks up the value of a global Float64Flag, returns
-// 0 if not found
-func (c *Context) GlobalFloat64(name string) float64 {
-	if fs := lookupGlobalFlagSet(name, c); fs != nil {
-		return lookupFloat64(name, fs)
-	}
-	return 0
-}
-
-func lookupFloat64(name string, set *flag.FlagSet) float64 {
-	f := set.Lookup(name)
-	if f != nil {
-		parsed, err := strconv.ParseFloat(f.Value.String(), 64)
-		if err != nil {
-			return 0
-		}
-		return parsed
-	}
-	return 0
-}
-
-// GenericFlag is a flag with type Generic
-type GenericFlag struct {
-	Name   string
-	Usage  string
-	EnvVar string
-	Hidden bool
-	Value  Generic
-}
-
-// String returns a readable representation of this value
-// (for usage defaults)
-func (f GenericFlag) String() string {
-	return FlagStringer(f)
-}
-
-// GetName returns the name of the flag
-func (f GenericFlag) GetName() string {
-	return f.Name
-}
-
-// Generic looks up the value of a local GenericFlag, returns
-// nil if not found
-func (c *Context) Generic(name string) interface{} {
-	return lookupGeneric(name, c.flagSet)
-}
-
-// GlobalGeneric looks up the value of a global GenericFlag, returns
-// nil if not found
-func (c *Context) GlobalGeneric(name string) interface{} {
-	if fs := lookupGlobalFlagSet(name, c); fs != nil {
-		return lookupGeneric(name, fs)
-	}
-	return nil
-}
-
-func lookupGeneric(name string, set *flag.FlagSet) interface{} {
-	f := set.Lookup(name)
-	if f != nil {
-		parsed, err := f.Value, error(nil)
-		if err != nil {
-			return nil
-		}
-		return parsed
-	}
-	return nil
-}
-
-// Int64Flag is a flag with type int64
-type Int64Flag struct {
-	Name        string
-	Usage       string
-	EnvVar      string
-	Hidden      bool
-	Value       int64
-	Destination *int64
-}
-
-// String returns a readable representation of this value
-// (for usage defaults)
-func (f Int64Flag) String() string {
-	return FlagStringer(f)
-}
-
-// GetName returns the name of the flag
-func (f Int64Flag) GetName() string {
-	return f.Name
-}
-
-// Int64 looks up the value of a local Int64Flag, returns
-// 0 if not found
-func (c *Context) Int64(name string) int64 {
-	return lookupInt64(name, c.flagSet)
-}
-
-// GlobalInt64 looks up the value of a global Int64Flag, returns
-// 0 if not found
-func (c *Context) GlobalInt64(name string) int64 {
-	if fs := lookupGlobalFlagSet(name, c); fs != nil {
-		return lookupInt64(name, fs)
-	}
-	return 0
-}
-
-func lookupInt64(name string, set *flag.FlagSet) int64 {
-	f := set.Lookup(name)
-	if f != nil {
-		parsed, err := strconv.ParseInt(f.Value.String(), 0, 64)
-		if err != nil {
-			return 0
-		}
-		return parsed
-	}
-	return 0
-}
-
-// IntFlag is a flag with type int
-type IntFlag struct {
-	Name        string
-	Usage       string
-	EnvVar      string
-	Hidden      bool
-	Value       int
-	Destination *int
-}
-
-// String returns a readable representation of this value
-// (for usage defaults)
-func (f IntFlag) String() string {
-	return FlagStringer(f)
-}
-
-// GetName returns the name of the flag
-func (f IntFlag) GetName() string {
-	return f.Name
-}
-
-// Int looks up the value of a local IntFlag, returns
-// 0 if not found
-func (c *Context) Int(name string) int {
-	return lookupInt(name, c.flagSet)
-}
-
-// GlobalInt looks up the value of a global IntFlag, returns
-// 0 if not found
-func (c *Context) GlobalInt(name string) int {
-	if fs := lookupGlobalFlagSet(name, c); fs != nil {
-		return lookupInt(name, fs)
-	}
-	return 0
-}
-
-func lookupInt(name string, set *flag.FlagSet) int {
-	f := set.Lookup(name)
-	if f != nil {
-		parsed, err := strconv.ParseInt(f.Value.String(), 0, 64)
-		if err != nil {
-			return 0
-		}
-		return int(parsed)
-	}
-	return 0
-}
-
-// IntSliceFlag is a flag with type *IntSlice
-type IntSliceFlag struct {
-	Name   string
-	Usage  string
-	EnvVar string
-	Hidden bool
-	Value  *IntSlice
-}
-
-// String returns a readable representation of this value
-// (for usage defaults)
-func (f IntSliceFlag) String() string {
-	return FlagStringer(f)
-}
-
-// GetName returns the name of the flag
-func (f IntSliceFlag) GetName() string {
-	return f.Name
-}
-
-// IntSlice looks up the value of a local IntSliceFlag, returns
-// nil if not found
-func (c *Context) IntSlice(name string) []int {
-	return lookupIntSlice(name, c.flagSet)
-}
-
-// GlobalIntSlice looks up the value of a global IntSliceFlag, returns
-// nil if not found
-func (c *Context) GlobalIntSlice(name string) []int {
-	if fs := lookupGlobalFlagSet(name, c); fs != nil {
-		return lookupIntSlice(name, fs)
-	}
-	return nil
-}
-
-func lookupIntSlice(name string, set *flag.FlagSet) []int {
-	f := set.Lookup(name)
-	if f != nil {
-		parsed, err := (f.Value.(*IntSlice)).Value(), error(nil)
-		if err != nil {
-			return nil
-		}
-		return parsed
-	}
-	return nil
-}
-
-// Int64SliceFlag is a flag with type *Int64Slice
-type Int64SliceFlag struct {
-	Name   string
-	Usage  string
-	EnvVar string
-	Hidden bool
-	Value  *Int64Slice
-}
-
-// String returns a readable representation of this value
-// (for usage defaults)
-func (f Int64SliceFlag) String() string {
-	return FlagStringer(f)
-}
-
-// GetName returns the name of the flag
-func (f Int64SliceFlag) GetName() string {
-	return f.Name
-}
-
-// Int64Slice looks up the value of a local Int64SliceFlag, returns
-// nil if not found
-func (c *Context) Int64Slice(name string) []int64 {
-	return lookupInt64Slice(name, c.flagSet)
-}
-
-// GlobalInt64Slice looks up the value of a global Int64SliceFlag, returns
-// nil if not found
-func (c *Context) GlobalInt64Slice(name string) []int64 {
-	if fs := lookupGlobalFlagSet(name, c); fs != nil {
-		return lookupInt64Slice(name, fs)
-	}
-	return nil
-}
-
-func lookupInt64Slice(name string, set *flag.FlagSet) []int64 {
-	f := set.Lookup(name)
-	if f != nil {
-		parsed, err := (f.Value.(*Int64Slice)).Value(), error(nil)
-		if err != nil {
-			return nil
-		}
-		return parsed
-	}
-	return nil
-}
-
-// StringFlag is a flag with type string
-type StringFlag struct {
-	Name        string
-	Usage       string
-	EnvVar      string
-	Hidden      bool
-	Value       string
-	Destination *string
-}
-
-// String returns a readable representation of this value
-// (for usage defaults)
-func (f StringFlag) String() string {
-	return FlagStringer(f)
-}
-
-// GetName returns the name of the flag
-func (f StringFlag) GetName() string {
-	return f.Name
-}
-
-// String looks up the value of a local StringFlag, returns
-// "" if not found
-func (c *Context) String(name string) string {
-	return lookupString(name, c.flagSet)
-}
-
-// GlobalString looks up the value of a global StringFlag, returns
-// "" if not found
-func (c *Context) GlobalString(name string) string {
-	if fs := lookupGlobalFlagSet(name, c); fs != nil {
-		return lookupString(name, fs)
-	}
-	return ""
-}
-
-func lookupString(name string, set *flag.FlagSet) string {
-	f := set.Lookup(name)
-	if f != nil {
-		parsed, err := f.Value.String(), error(nil)
-		if err != nil {
-			return ""
-		}
-		return parsed
-	}
-	return ""
-}
-
-// StringSliceFlag is a flag with type *StringSlice
-type StringSliceFlag struct {
-	Name   string
-	Usage  string
-	EnvVar string
-	Hidden bool
-	Value  *StringSlice
-}
-
-// String returns a readable representation of this value
-// (for usage defaults)
-func (f StringSliceFlag) String() string {
-	return FlagStringer(f)
-}
-
-// GetName returns the name of the flag
-func (f StringSliceFlag) GetName() string {
-	return f.Name
-}
-
-// StringSlice looks up the value of a local StringSliceFlag, returns
-// nil if not found
-func (c *Context) StringSlice(name string) []string {
-	return lookupStringSlice(name, c.flagSet)
-}
-
-// GlobalStringSlice looks up the value of a global StringSliceFlag, returns
-// nil if not found
-func (c *Context) GlobalStringSlice(name string) []string {
-	if fs := lookupGlobalFlagSet(name, c); fs != nil {
-		return lookupStringSlice(name, fs)
-	}
-	return nil
-}
-
-func lookupStringSlice(name string, set *flag.FlagSet) []string {
-	f := set.Lookup(name)
-	if f != nil {
-		parsed, err := (f.Value.(*StringSlice)).Value(), error(nil)
-		if err != nil {
-			return nil
-		}
-		return parsed
-	}
-	return nil
-}
-
-// Uint64Flag is a flag with type uint64
-type Uint64Flag struct {
-	Name        string
-	Usage       string
-	EnvVar      string
-	Hidden      bool
-	Value       uint64
-	Destination *uint64
-}
-
-// String returns a readable representation of this value
-// (for usage defaults)
-func (f Uint64Flag) String() string {
-	return FlagStringer(f)
-}
-
-// GetName returns the name of the flag
-func (f Uint64Flag) GetName() string {
-	return f.Name
-}
-
-// Uint64 looks up the value of a local Uint64Flag, returns
-// 0 if not found
-func (c *Context) Uint64(name string) uint64 {
-	return lookupUint64(name, c.flagSet)
-}
-
-// GlobalUint64 looks up the value of a global Uint64Flag, returns
-// 0 if not found
-func (c *Context) GlobalUint64(name string) uint64 {
-	if fs := lookupGlobalFlagSet(name, c); fs != nil {
-		return lookupUint64(name, fs)
-	}
-	return 0
-}
-
-func lookupUint64(name string, set *flag.FlagSet) uint64 {
-	f := set.Lookup(name)
-	if f != nil {
-		parsed, err := strconv.ParseUint(f.Value.String(), 0, 64)
-		if err != nil {
-			return 0
-		}
-		return parsed
-	}
-	return 0
-}
-
-// UintFlag is a flag with type uint
-type UintFlag struct {
-	Name        string
-	Usage       string
-	EnvVar      string
-	Hidden      bool
-	Value       uint
-	Destination *uint
-}
-
-// String returns a readable representation of this value
-// (for usage defaults)
-func (f UintFlag) String() string {
-	return FlagStringer(f)
-}
-
-// GetName returns the name of the flag
-func (f UintFlag) GetName() string {
-	return f.Name
-}
-
-// Uint looks up the value of a local UintFlag, returns
-// 0 if not found
-func (c *Context) Uint(name string) uint {
-	return lookupUint(name, c.flagSet)
-}
-
-// GlobalUint looks up the value of a global UintFlag, returns
-// 0 if not found
-func (c *Context) GlobalUint(name string) uint {
-	if fs := lookupGlobalFlagSet(name, c); fs != nil {
-		return lookupUint(name, fs)
-	}
-	return 0
-}
-
-func lookupUint(name string, set *flag.FlagSet) uint {
-	f := set.Lookup(name)
-	if f != nil {
-		parsed, err := strconv.ParseUint(f.Value.String(), 0, 64)
-		if err != nil {
-			return 0
-		}
-		return uint(parsed)
-	}
-	return 0
-}

+ 0 - 28
bashbrew/go/vendor/github.com/codegangsta/cli/funcs.go

@@ -1,28 +0,0 @@
-package cli
-
-// BashCompleteFunc is an action to execute when the bash-completion flag is set
-type BashCompleteFunc func(*Context)
-
-// BeforeFunc is an action to execute before any subcommands are run, but after
-// the context is ready if a non-nil error is returned, no subcommands are run
-type BeforeFunc func(*Context) error
-
-// AfterFunc is an action to execute after any subcommands are run, but after the
-// subcommand has finished it is run even if Action() panics
-type AfterFunc func(*Context) error
-
-// ActionFunc is the action to execute when no subcommands are specified
-type ActionFunc func(*Context) error
-
-// CommandNotFoundFunc is executed if the proper command cannot be found
-type CommandNotFoundFunc func(*Context, string)
-
-// OnUsageErrorFunc is executed if an usage error occurs. This is useful for displaying
-// customized usage error messages.  This function is able to replace the
-// original error messages.  If this function is not set, the "Incorrect usage"
-// is displayed and the execution is interrupted.
-type OnUsageErrorFunc func(context *Context, err error, isSubcommand bool) error
-
-// FlagStringFunc is used by the help generation to display a flag, which is
-// expected to be a single line.
-type FlagStringFunc func(Flag) string

+ 0 - 255
bashbrew/go/vendor/github.com/codegangsta/cli/generate-flag-types

@@ -1,255 +0,0 @@
-#!/usr/bin/env python
-"""
-The flag types that ship with the cli library have many things in common, and
-so we can take advantage of the `go generate` command to create much of the
-source code from a list of definitions.  These definitions attempt to cover
-the parts that vary between flag types, and should evolve as needed.
-
-An example of the minimum definition needed is:
-
-    {
-      "name": "SomeType",
-      "type": "sometype",
-      "context_default": "nil"
-    }
-
-In this example, the code generated for the `cli` package will include a type
-named `SomeTypeFlag` that is expected to wrap a value of type `sometype`.
-Fetching values by name via `*cli.Context` will default to a value of `nil`.
-
-A more complete, albeit somewhat redundant, example showing all available
-definition keys is:
-
-    {
-      "name": "VeryMuchType",
-      "type": "*VeryMuchType",
-      "value": true,
-      "dest": false,
-      "doctail": " which really only wraps a []float64, oh well!",
-      "context_type": "[]float64",
-      "context_default": "nil",
-      "parser": "parseVeryMuchType(f.Value.String())",
-      "parser_cast": "[]float64(parsed)"
-    }
-
-The meaning of each field is as follows:
-
-               name (string) - The type "name", which will be suffixed with
-                               `Flag` when generating the type definition
-                               for `cli` and the wrapper type for `altsrc`
-               type (string) - The type that the generated `Flag` type for `cli`
-                               is expected to "contain" as its `.Value` member
-                value (bool) - Should the generated `cli` type have a `Value`
-                               member?
-                 dest (bool) - Should the generated `cli` type support a
-                               destination pointer?
-            doctail (string) - Additional docs for the `cli` flag type comment
-       context_type (string) - The literal type used in the `*cli.Context`
-                               reader func signature
-    context_default (string) - The literal value used as the default by the
-                               `*cli.Context` reader funcs when no value is
-                               present
-             parser (string) - Literal code used to parse the flag `f`,
-                               expected to have a return signature of
-                               (value, error)
-        parser_cast (string) - Literal code used to cast the `parsed` value
-                               returned from the `parser` code
-"""
-
-from __future__ import print_function, unicode_literals
-
-import argparse
-import json
-import os
-import subprocess
-import sys
-import tempfile
-import textwrap
-
-
-class _FancyFormatter(argparse.ArgumentDefaultsHelpFormatter,
-                      argparse.RawDescriptionHelpFormatter):
-    pass
-
-
-def main(sysargs=sys.argv[:]):
-    parser = argparse.ArgumentParser(
-        description='Generate flag type code!',
-        formatter_class=_FancyFormatter)
-    parser.add_argument(
-        'package',
-        type=str, default='cli', choices=_WRITEFUNCS.keys(),
-        help='Package for which flag types will be generated'
-    )
-    parser.add_argument(
-        '-i', '--in-json',
-        type=argparse.FileType('r'),
-        default=sys.stdin,
-        help='Input JSON file which defines each type to be generated'
-    )
-    parser.add_argument(
-        '-o', '--out-go',
-        type=argparse.FileType('w'),
-        default=sys.stdout,
-        help='Output file/stream to which generated source will be written'
-    )
-    parser.epilog = __doc__
-
-    args = parser.parse_args(sysargs[1:])
-    _generate_flag_types(_WRITEFUNCS[args.package], args.out_go, args.in_json)
-    return 0
-
-
-def _generate_flag_types(writefunc, output_go, input_json):
-    types = json.load(input_json)
-
-    tmp = tempfile.NamedTemporaryFile(suffix='.go', delete=False)
-    writefunc(tmp, types)
-    tmp.close()
-
-    new_content = subprocess.check_output(
-        ['goimports', tmp.name]
-    ).decode('utf-8')
-
-    print(new_content, file=output_go, end='')
-    output_go.flush()
-    os.remove(tmp.name)
-
-
-def _set_typedef_defaults(typedef):
-    typedef.setdefault('doctail', '')
-    typedef.setdefault('context_type', typedef['type'])
-    typedef.setdefault('dest', True)
-    typedef.setdefault('value', True)
-    typedef.setdefault('parser', 'f.Value, error(nil)')
-    typedef.setdefault('parser_cast', 'parsed')
-
-
-def _write_cli_flag_types(outfile, types):
-    _fwrite(outfile, """\
-        package cli
-
-        // WARNING: This file is generated!
-
-        """)
-
-    for typedef in types:
-        _set_typedef_defaults(typedef)
-
-        _fwrite(outfile, """\
-        // {name}Flag is a flag with type {type}{doctail}
-        type {name}Flag struct {{
-            Name string
-            Usage string
-            EnvVar string
-            Hidden bool
-        """.format(**typedef))
-
-        if typedef['value']:
-            _fwrite(outfile, """\
-            Value {type}
-            """.format(**typedef))
-
-        if typedef['dest']:
-            _fwrite(outfile, """\
-            Destination *{type}
-            """.format(**typedef))
-
-        _fwrite(outfile, "\n}\n\n")
-
-        _fwrite(outfile, """\
-            // String returns a readable representation of this value
-            // (for usage defaults)
-            func (f {name}Flag) String() string {{
-                return FlagStringer(f)
-            }}
-
-            // GetName returns the name of the flag
-            func (f {name}Flag) GetName() string {{
-                return f.Name
-            }}
-
-            // {name} looks up the value of a local {name}Flag, returns
-            // {context_default} if not found
-            func (c *Context) {name}(name string) {context_type} {{
-                return lookup{name}(name, c.flagSet)
-            }}
-
-            // Global{name} looks up the value of a global {name}Flag, returns
-            // {context_default} if not found
-            func (c *Context) Global{name}(name string) {context_type} {{
-                if fs := lookupGlobalFlagSet(name, c); fs != nil {{
-                    return lookup{name}(name, fs)
-                }}
-                return {context_default}
-            }}
-
-            func lookup{name}(name string, set *flag.FlagSet) {context_type} {{
-                f := set.Lookup(name)
-                if f != nil {{
-                    parsed, err := {parser}
-                    if err != nil {{
-                        return {context_default}
-                    }}
-                    return {parser_cast}
-                }}
-                return {context_default}
-            }}
-            """.format(**typedef))
-
-
-def _write_altsrc_flag_types(outfile, types):
-    _fwrite(outfile, """\
-        package altsrc
-
-        import (
-            "gopkg.in/urfave/cli.v1"
-        )
-
-        // WARNING: This file is generated!
-
-        """)
-
-    for typedef in types:
-        _set_typedef_defaults(typedef)
-
-        _fwrite(outfile, """\
-        // {name}Flag is the flag type that wraps cli.{name}Flag to allow
-        // for other values to be specified
-        type {name}Flag struct {{
-            cli.{name}Flag
-            set *flag.FlagSet
-        }}
-
-        // New{name}Flag creates a new {name}Flag
-        func New{name}Flag(fl cli.{name}Flag) *{name}Flag {{
-            return &{name}Flag{{{name}Flag: fl, set: nil}}
-        }}
-
-        // Apply saves the flagSet for later usage calls, then calls the
-        // wrapped {name}Flag.Apply
-        func (f *{name}Flag) Apply(set *flag.FlagSet) {{
-            f.set = set
-            f.{name}Flag.Apply(set)
-        }}
-
-        // ApplyWithError saves the flagSet for later usage calls, then calls the
-        // wrapped {name}Flag.ApplyWithError
-        func (f *{name}Flag) ApplyWithError(set *flag.FlagSet) error {{
-            f.set = set
-            return f.{name}Flag.ApplyWithError(set)
-        }}
-        """.format(**typedef))
-
-
-def _fwrite(outfile, text):
-    print(textwrap.dedent(text), end='', file=outfile)
-
-
-_WRITEFUNCS = {
-    'cli': _write_cli_flag_types,
-    'altsrc': _write_altsrc_flag_types
-}
-
-if __name__ == '__main__':
-    sys.exit(main())

+ 0 - 338
bashbrew/go/vendor/github.com/codegangsta/cli/help.go

@@ -1,338 +0,0 @@
-package cli
-
-import (
-	"fmt"
-	"io"
-	"os"
-	"strings"
-	"text/tabwriter"
-	"text/template"
-)
-
-// AppHelpTemplate is the text template for the Default help topic.
-// cli.go uses text/template to render templates. You can
-// render custom help text by setting this variable.
-var AppHelpTemplate = `NAME:
-   {{.Name}}{{if .Usage}} - {{.Usage}}{{end}}
-
-USAGE:
-   {{if .UsageText}}{{.UsageText}}{{else}}{{.HelpName}} {{if .VisibleFlags}}[global options]{{end}}{{if .Commands}} command [command options]{{end}} {{if .ArgsUsage}}{{.ArgsUsage}}{{else}}[arguments...]{{end}}{{end}}{{if .Version}}{{if not .HideVersion}}
-
-VERSION:
-   {{.Version}}{{end}}{{end}}{{if .Description}}
-
-DESCRIPTION:
-   {{.Description}}{{end}}{{if len .Authors}}
-
-AUTHOR{{with $length := len .Authors}}{{if ne 1 $length}}S{{end}}{{end}}:
-   {{range $index, $author := .Authors}}{{if $index}}
-   {{end}}{{$author}}{{end}}{{end}}{{if .VisibleCommands}}
-
-COMMANDS:{{range .VisibleCategories}}{{if .Name}}
-   {{.Name}}:{{end}}{{range .VisibleCommands}}
-     {{join .Names ", "}}{{"\t"}}{{.Usage}}{{end}}{{end}}{{end}}{{if .VisibleFlags}}
-
-GLOBAL OPTIONS:
-   {{range $index, $option := .VisibleFlags}}{{if $index}}
-   {{end}}{{$option}}{{end}}{{end}}{{if .Copyright}}
-
-COPYRIGHT:
-   {{.Copyright}}{{end}}
-`
-
-// CommandHelpTemplate is the text template for the command help topic.
-// cli.go uses text/template to render templates. You can
-// render custom help text by setting this variable.
-var CommandHelpTemplate = `NAME:
-   {{.HelpName}} - {{.Usage}}
-
-USAGE:
-   {{if .UsageText}}{{.UsageText}}{{else}}{{.HelpName}}{{if .VisibleFlags}} [command options]{{end}} {{if .ArgsUsage}}{{.ArgsUsage}}{{else}}[arguments...]{{end}}{{end}}{{if .Category}}
-
-CATEGORY:
-   {{.Category}}{{end}}{{if .Description}}
-
-DESCRIPTION:
-   {{.Description}}{{end}}{{if .VisibleFlags}}
-
-OPTIONS:
-   {{range .VisibleFlags}}{{.}}
-   {{end}}{{end}}
-`
-
-// SubcommandHelpTemplate is the text template for the subcommand help topic.
-// cli.go uses text/template to render templates. You can
-// render custom help text by setting this variable.
-var SubcommandHelpTemplate = `NAME:
-   {{.HelpName}} - {{if .Description}}{{.Description}}{{else}}{{.Usage}}{{end}}
-
-USAGE:
-   {{if .UsageText}}{{.UsageText}}{{else}}{{.HelpName}} command{{if .VisibleFlags}} [command options]{{end}} {{if .ArgsUsage}}{{.ArgsUsage}}{{else}}[arguments...]{{end}}{{end}}
-
-COMMANDS:{{range .VisibleCategories}}{{if .Name}}
-   {{.Name}}:{{end}}{{range .VisibleCommands}}
-     {{join .Names ", "}}{{"\t"}}{{.Usage}}{{end}}
-{{end}}{{if .VisibleFlags}}
-OPTIONS:
-   {{range .VisibleFlags}}{{.}}
-   {{end}}{{end}}
-`
-
-var helpCommand = Command{
-	Name:      "help",
-	Aliases:   []string{"h"},
-	Usage:     "Shows a list of commands or help for one command",
-	ArgsUsage: "[command]",
-	Action: func(c *Context) error {
-		args := c.Args()
-		if args.Present() {
-			return ShowCommandHelp(c, args.First())
-		}
-
-		ShowAppHelp(c)
-		return nil
-	},
-}
-
-var helpSubcommand = Command{
-	Name:      "help",
-	Aliases:   []string{"h"},
-	Usage:     "Shows a list of commands or help for one command",
-	ArgsUsage: "[command]",
-	Action: func(c *Context) error {
-		args := c.Args()
-		if args.Present() {
-			return ShowCommandHelp(c, args.First())
-		}
-
-		return ShowSubcommandHelp(c)
-	},
-}
-
-// Prints help for the App or Command
-type helpPrinter func(w io.Writer, templ string, data interface{})
-
-// Prints help for the App or Command with custom template function.
-type helpPrinterCustom func(w io.Writer, templ string, data interface{}, customFunc map[string]interface{})
-
-// HelpPrinter is a function that writes the help output. If not set a default
-// is used. The function signature is:
-// func(w io.Writer, templ string, data interface{})
-var HelpPrinter helpPrinter = printHelp
-
-// HelpPrinterCustom is same as HelpPrinter but
-// takes a custom function for template function map.
-var HelpPrinterCustom helpPrinterCustom = printHelpCustom
-
-// VersionPrinter prints the version for the App
-var VersionPrinter = printVersion
-
-// ShowAppHelpAndExit - Prints the list of subcommands for the app and exits with exit code.
-func ShowAppHelpAndExit(c *Context, exitCode int) {
-	ShowAppHelp(c)
-	os.Exit(exitCode)
-}
-
-// ShowAppHelp is an action that displays the help.
-func ShowAppHelp(c *Context) (err error) {
-	if c.App.CustomAppHelpTemplate == "" {
-		HelpPrinter(c.App.Writer, AppHelpTemplate, c.App)
-		return
-	}
-	customAppData := func() map[string]interface{} {
-		if c.App.ExtraInfo == nil {
-			return nil
-		}
-		return map[string]interface{}{
-			"ExtraInfo": c.App.ExtraInfo,
-		}
-	}
-	HelpPrinterCustom(c.App.Writer, c.App.CustomAppHelpTemplate, c.App, customAppData())
-	return nil
-}
-
-// DefaultAppComplete prints the list of subcommands as the default app completion method
-func DefaultAppComplete(c *Context) {
-	for _, command := range c.App.Commands {
-		if command.Hidden {
-			continue
-		}
-		for _, name := range command.Names() {
-			fmt.Fprintln(c.App.Writer, name)
-		}
-	}
-}
-
-// ShowCommandHelpAndExit - exits with code after showing help
-func ShowCommandHelpAndExit(c *Context, command string, code int) {
-	ShowCommandHelp(c, command)
-	os.Exit(code)
-}
-
-// ShowCommandHelp prints help for the given command
-func ShowCommandHelp(ctx *Context, command string) error {
-	// show the subcommand help for a command with subcommands
-	if command == "" {
-		HelpPrinter(ctx.App.Writer, SubcommandHelpTemplate, ctx.App)
-		return nil
-	}
-
-	for _, c := range ctx.App.Commands {
-		if c.HasName(command) {
-			if c.CustomHelpTemplate != "" {
-				HelpPrinterCustom(ctx.App.Writer, c.CustomHelpTemplate, c, nil)
-			} else {
-				HelpPrinter(ctx.App.Writer, CommandHelpTemplate, c)
-			}
-			return nil
-		}
-	}
-
-	if ctx.App.CommandNotFound == nil {
-		return NewExitError(fmt.Sprintf("No help topic for '%v'", command), 3)
-	}
-
-	ctx.App.CommandNotFound(ctx, command)
-	return nil
-}
-
-// ShowSubcommandHelp prints help for the given subcommand
-func ShowSubcommandHelp(c *Context) error {
-	return ShowCommandHelp(c, c.Command.Name)
-}
-
-// ShowVersion prints the version number of the App
-func ShowVersion(c *Context) {
-	VersionPrinter(c)
-}
-
-func printVersion(c *Context) {
-	fmt.Fprintf(c.App.Writer, "%v version %v\n", c.App.Name, c.App.Version)
-}
-
-// ShowCompletions prints the lists of commands within a given context
-func ShowCompletions(c *Context) {
-	a := c.App
-	if a != nil && a.BashComplete != nil {
-		a.BashComplete(c)
-	}
-}
-
-// ShowCommandCompletions prints the custom completions for a given command
-func ShowCommandCompletions(ctx *Context, command string) {
-	c := ctx.App.Command(command)
-	if c != nil && c.BashComplete != nil {
-		c.BashComplete(ctx)
-	}
-}
-
-func printHelpCustom(out io.Writer, templ string, data interface{}, customFunc map[string]interface{}) {
-	funcMap := template.FuncMap{
-		"join": strings.Join,
-	}
-	if customFunc != nil {
-		for key, value := range customFunc {
-			funcMap[key] = value
-		}
-	}
-
-	w := tabwriter.NewWriter(out, 1, 8, 2, ' ', 0)
-	t := template.Must(template.New("help").Funcs(funcMap).Parse(templ))
-	err := t.Execute(w, data)
-	if err != nil {
-		// If the writer is closed, t.Execute will fail, and there's nothing
-		// we can do to recover.
-		if os.Getenv("CLI_TEMPLATE_ERROR_DEBUG") != "" {
-			fmt.Fprintf(ErrWriter, "CLI TEMPLATE ERROR: %#v\n", err)
-		}
-		return
-	}
-	w.Flush()
-}
-
-func printHelp(out io.Writer, templ string, data interface{}) {
-	printHelpCustom(out, templ, data, nil)
-}
-
-func checkVersion(c *Context) bool {
-	found := false
-	if VersionFlag.GetName() != "" {
-		eachName(VersionFlag.GetName(), func(name string) {
-			if c.GlobalBool(name) || c.Bool(name) {
-				found = true
-			}
-		})
-	}
-	return found
-}
-
-func checkHelp(c *Context) bool {
-	found := false
-	if HelpFlag.GetName() != "" {
-		eachName(HelpFlag.GetName(), func(name string) {
-			if c.GlobalBool(name) || c.Bool(name) {
-				found = true
-			}
-		})
-	}
-	return found
-}
-
-func checkCommandHelp(c *Context, name string) bool {
-	if c.Bool("h") || c.Bool("help") {
-		ShowCommandHelp(c, name)
-		return true
-	}
-
-	return false
-}
-
-func checkSubcommandHelp(c *Context) bool {
-	if c.Bool("h") || c.Bool("help") {
-		ShowSubcommandHelp(c)
-		return true
-	}
-
-	return false
-}
-
-func checkShellCompleteFlag(a *App, arguments []string) (bool, []string) {
-	if !a.EnableBashCompletion {
-		return false, arguments
-	}
-
-	pos := len(arguments) - 1
-	lastArg := arguments[pos]
-
-	if lastArg != "--"+BashCompletionFlag.GetName() {
-		return false, arguments
-	}
-
-	return true, arguments[:pos]
-}
-
-func checkCompletions(c *Context) bool {
-	if !c.shellComplete {
-		return false
-	}
-
-	if args := c.Args(); args.Present() {
-		name := args.First()
-		if cmd := c.App.Command(name); cmd != nil {
-			// let the command handle the completion
-			return false
-		}
-	}
-
-	ShowCompletions(c)
-	return true
-}
-
-func checkCommandCompletions(c *Context, name string) bool {
-	if !c.shellComplete {
-		return false
-	}
-
-	ShowCommandCompletions(c, name)
-	return true
-}

+ 0 - 122
bashbrew/go/vendor/github.com/codegangsta/cli/runtests

@@ -1,122 +0,0 @@
-#!/usr/bin/env python
-from __future__ import print_function
-
-import argparse
-import os
-import sys
-import tempfile
-
-from subprocess import check_call, check_output
-
-
-PACKAGE_NAME = os.environ.get(
-    'CLI_PACKAGE_NAME', 'github.com/urfave/cli'
-)
-
-
-def main(sysargs=sys.argv[:]):
-    targets = {
-        'vet': _vet,
-        'test': _test,
-        'gfmrun': _gfmrun,
-        'toc': _toc,
-        'gen': _gen,
-    }
-
-    parser = argparse.ArgumentParser()
-    parser.add_argument(
-        'target', nargs='?', choices=tuple(targets.keys()), default='test'
-    )
-    args = parser.parse_args(sysargs[1:])
-
-    targets[args.target]()
-    return 0
-
-
-def _test():
-    if check_output('go version'.split()).split()[2] < 'go1.2':
-        _run('go test -v .')
-        return
-
-    coverprofiles = []
-    for subpackage in ['', 'altsrc']:
-        coverprofile = 'cli.coverprofile'
-        if subpackage != '':
-            coverprofile = '{}.coverprofile'.format(subpackage)
-
-        coverprofiles.append(coverprofile)
-
-        _run('go test -v'.split() + [
-            '-coverprofile={}'.format(coverprofile),
-            ('{}/{}'.format(PACKAGE_NAME, subpackage)).rstrip('/')
-        ])
-
-    combined_name = _combine_coverprofiles(coverprofiles)
-    _run('go tool cover -func={}'.format(combined_name))
-    os.remove(combined_name)
-
-
-def _gfmrun():
-    go_version = check_output('go version'.split()).split()[2]
-    if go_version < 'go1.3':
-        print('runtests: skip on {}'.format(go_version), file=sys.stderr)
-        return
-    _run(['gfmrun', '-c', str(_gfmrun_count()), '-s', 'README.md'])
-
-
-def _vet():
-    _run('go vet ./...')
-
-
-def _toc():
-    _run('node_modules/.bin/markdown-toc -i README.md')
-    _run('git diff --exit-code')
-
-
-def _gen():
-    go_version = check_output('go version'.split()).split()[2]
-    if go_version < 'go1.5':
-        print('runtests: skip on {}'.format(go_version), file=sys.stderr)
-        return
-
-    _run('go generate ./...')
-    _run('git diff --exit-code')
-
-
-def _run(command):
-    if hasattr(command, 'split'):
-        command = command.split()
-    print('runtests: {}'.format(' '.join(command)), file=sys.stderr)
-    check_call(command)
-
-
-def _gfmrun_count():
-    with open('README.md') as infile:
-        lines = infile.read().splitlines()
-        return len(filter(_is_go_runnable, lines))
-
-
-def _is_go_runnable(line):
-    return line.startswith('package main')
-
-
-def _combine_coverprofiles(coverprofiles):
-    combined = tempfile.NamedTemporaryFile(
-        suffix='.coverprofile', delete=False
-    )
-    combined.write('mode: set\n')
-
-    for coverprofile in coverprofiles:
-        with open(coverprofile, 'r') as infile:
-            for line in infile.readlines():
-                if not line.startswith('mode: '):
-                    combined.write(line)
-
-    combined.flush()
-    name = combined.name
-    combined.close()
-    return name
-
-
-if __name__ == '__main__':
-    sys.exit(main())

+ 0 - 191
bashbrew/go/vendor/github.com/docker-library/go-dockerlibrary/LICENSE

@@ -1,191 +0,0 @@
-
-                                 Apache License
-                           Version 2.0, January 2004
-                        http://www.apache.org/licenses/
-
-   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
-   1. Definitions.
-
-      "License" shall mean the terms and conditions for use, reproduction,
-      and distribution as defined by Sections 1 through 9 of this document.
-
-      "Licensor" shall mean the copyright owner or entity authorized by
-      the copyright owner that is granting the License.
-
-      "Legal Entity" shall mean the union of the acting entity and all
-      other entities that control, are controlled by, or are under common
-      control with that entity. For the purposes of this definition,
-      "control" means (i) the power, direct or indirect, to cause the
-      direction or management of such entity, whether by contract or
-      otherwise, or (ii) ownership of fifty percent (50%) or more of the
-      outstanding shares, or (iii) beneficial ownership of such entity.
-
-      "You" (or "Your") shall mean an individual or Legal Entity
-      exercising permissions granted by this License.
-
-      "Source" form shall mean the preferred form for making modifications,
-      including but not limited to software source code, documentation
-      source, and configuration files.
-
-      "Object" form shall mean any form resulting from mechanical
-      transformation or translation of a Source form, including but
-      not limited to compiled object code, generated documentation,
-      and conversions to other media types.
-
-      "Work" shall mean the work of authorship, whether in Source or
-      Object form, made available under the License, as indicated by a
-      copyright notice that is included in or attached to the work
-      (an example is provided in the Appendix below).
-
-      "Derivative Works" shall mean any work, whether in Source or Object
-      form, that is based on (or derived from) the Work and for which the
-      editorial revisions, annotations, elaborations, or other modifications
-      represent, as a whole, an original work of authorship. For the purposes
-      of this License, Derivative Works shall not include works that remain
-      separable from, or merely link (or bind by name) to the interfaces of,
-      the Work and Derivative Works thereof.
-
-      "Contribution" shall mean any work of authorship, including
-      the original version of the Work and any modifications or additions
-      to that Work or Derivative Works thereof, that is intentionally
-      submitted to Licensor for inclusion in the Work by the copyright owner
-      or by an individual or Legal Entity authorized to submit on behalf of
-      the copyright owner. For the purposes of this definition, "submitted"
-      means any form of electronic, verbal, or written communication sent
-      to the Licensor or its representatives, including but not limited to
-      communication on electronic mailing lists, source code control systems,
-      and issue tracking systems that are managed by, or on behalf of, the
-      Licensor for the purpose of discussing and improving the Work, but
-      excluding communication that is conspicuously marked or otherwise
-      designated in writing by the copyright owner as "Not a Contribution."
-
-      "Contributor" shall mean Licensor and any individual or Legal Entity
-      on behalf of whom a Contribution has been received by Licensor and
-      subsequently incorporated within the Work.
-
-   2. Grant of Copyright License. Subject to the terms and conditions of
-      this License, each Contributor hereby grants to You a perpetual,
-      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
-      copyright license to reproduce, prepare Derivative Works of,
-      publicly display, publicly perform, sublicense, and distribute the
-      Work and such Derivative Works in Source or Object form.
-
-   3. Grant of Patent License. Subject to the terms and conditions of
-      this License, each Contributor hereby grants to You a perpetual,
-      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
-      (except as stated in this section) patent license to make, have made,
-      use, offer to sell, sell, import, and otherwise transfer the Work,
-      where such license applies only to those patent claims licensable
-      by such Contributor that are necessarily infringed by their
-      Contribution(s) alone or by combination of their Contribution(s)
-      with the Work to which such Contribution(s) was submitted. If You
-      institute patent litigation against any entity (including a
-      cross-claim or counterclaim in a lawsuit) alleging that the Work
-      or a Contribution incorporated within the Work constitutes direct
-      or contributory patent infringement, then any patent licenses
-      granted to You under this License for that Work shall terminate
-      as of the date such litigation is filed.
-
-   4. Redistribution. You may reproduce and distribute copies of the
-      Work or Derivative Works thereof in any medium, with or without
-      modifications, and in Source or Object form, provided that You
-      meet the following conditions:
-
-      (a) You must give any other recipients of the Work or
-          Derivative Works a copy of this License; and
-
-      (b) You must cause any modified files to carry prominent notices
-          stating that You changed the files; and
-
-      (c) You must retain, in the Source form of any Derivative Works
-          that You distribute, all copyright, patent, trademark, and
-          attribution notices from the Source form of the Work,
-          excluding those notices that do not pertain to any part of
-          the Derivative Works; and
-
-      (d) If the Work includes a "NOTICE" text file as part of its
-          distribution, then any Derivative Works that You distribute must
-          include a readable copy of the attribution notices contained
-          within such NOTICE file, excluding those notices that do not
-          pertain to any part of the Derivative Works, in at least one
-          of the following places: within a NOTICE text file distributed
-          as part of the Derivative Works; within the Source form or
-          documentation, if provided along with the Derivative Works; or,
-          within a display generated by the Derivative Works, if and
-          wherever such third-party notices normally appear. The contents
-          of the NOTICE file are for informational purposes only and
-          do not modify the License. You may add Your own attribution
-          notices within Derivative Works that You distribute, alongside
-          or as an addendum to the NOTICE text from the Work, provided
-          that such additional attribution notices cannot be construed
-          as modifying the License.
-
-      You may add Your own copyright statement to Your modifications and
-      may provide additional or different license terms and conditions
-      for use, reproduction, or distribution of Your modifications, or
-      for any such Derivative Works as a whole, provided Your use,
-      reproduction, and distribution of the Work otherwise complies with
-      the conditions stated in this License.
-
-   5. Submission of Contributions. Unless You explicitly state otherwise,
-      any Contribution intentionally submitted for inclusion in the Work
-      by You to the Licensor shall be under the terms and conditions of
-      this License, without any additional terms or conditions.
-      Notwithstanding the above, nothing herein shall supersede or modify
-      the terms of any separate license agreement you may have executed
-      with Licensor regarding such Contributions.
-
-   6. Trademarks. This License does not grant permission to use the trade
-      names, trademarks, service marks, or product names of the Licensor,
-      except as required for reasonable and customary use in describing the
-      origin of the Work and reproducing the content of the NOTICE file.
-
-   7. Disclaimer of Warranty. Unless required by applicable law or
-      agreed to in writing, Licensor provides the Work (and each
-      Contributor provides its Contributions) on an "AS IS" BASIS,
-      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
-      implied, including, without limitation, any warranties or conditions
-      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
-      PARTICULAR PURPOSE. You are solely responsible for determining the
-      appropriateness of using or redistributing the Work and assume any
-      risks associated with Your exercise of permissions under this License.
-
-   8. Limitation of Liability. In no event and under no legal theory,
-      whether in tort (including negligence), contract, or otherwise,
-      unless required by applicable law (such as deliberate and grossly
-      negligent acts) or agreed to in writing, shall any Contributor be
-      liable to You for damages, including any direct, indirect, special,
-      incidental, or consequential damages of any character arising as a
-      result of this License or out of the use or inability to use the
-      Work (including but not limited to damages for loss of goodwill,
-      work stoppage, computer failure or malfunction, or any and all
-      other commercial damages or losses), even if such Contributor
-      has been advised of the possibility of such damages.
-
-   9. Accepting Warranty or Additional Liability. While redistributing
-      the Work or Derivative Works thereof, You may choose to offer,
-      and charge a fee for, acceptance of support, warranty, indemnity,
-      or other liability obligations and/or rights consistent with this
-      License. However, in accepting such obligations, You may act only
-      on Your own behalf and on Your sole responsibility, not on behalf
-      of any other Contributor, and only if You agree to indemnify,
-      defend, and hold each Contributor harmless for any liability
-      incurred by, or claims asserted against, such Contributor by reason
-      of your accepting any such warranty or additional liability.
-
-   END OF TERMS AND CONDITIONS
-
-   Copyright 2014 Docker, Inc.
-
-   Licensed under the Apache License, Version 2.0 (the "License");
-   you may not use this file except in compliance with the License.
-   You may obtain a copy of the License at
-
-       http://www.apache.org/licenses/LICENSE-2.0
-
-   Unless required by applicable law or agreed to in writing, software
-   distributed under the License is distributed on an "AS IS" BASIS,
-   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-   See the License for the specific language governing permissions and
-   limitations under the License.

+ 0 - 26
bashbrew/go/vendor/github.com/docker-library/go-dockerlibrary/architecture/oci-platform.go

@@ -1,26 +0,0 @@
-package architecture
-
-// https://github.com/opencontainers/image-spec/blob/v1.0.1/image-index.md#image-index-property-descriptions
-// see "platform" (under "manifests")
-type OCIPlatform struct {
-	OS           string `json:"os"`
-	Architecture string `json:"architecture"`
-	Variant      string `json:"variant,omitempty"`
-
-	//OSVersion  string   `json:"os.version,omitempty"`
-	//OSFeatures []string `json:"os.features,omitempty"`
-}
-
-var SupportedArches = map[string]OCIPlatform{
-	"amd64":    {OS: "linux", Architecture: "amd64"},
-	"arm32v5":  {OS: "linux", Architecture: "arm", Variant: "v5"},
-	"arm32v6":  {OS: "linux", Architecture: "arm", Variant: "v6"},
-	"arm32v7":  {OS: "linux", Architecture: "arm", Variant: "v7"},
-	"arm64v8":  {OS: "linux", Architecture: "arm64", Variant: "v8"},
-	"i386":     {OS: "linux", Architecture: "386"},
-	"mips64le": {OS: "linux", Architecture: "mips64le"},
-	"ppc64le":  {OS: "linux", Architecture: "ppc64le"},
-	"s390x":    {OS: "linux", Architecture: "s390x"},
-
-	"windows-amd64": {OS: "windows", Architecture: "amd64"},
-}

+ 0 - 73
bashbrew/go/vendor/github.com/docker-library/go-dockerlibrary/manifest/fetch.go

@@ -1,73 +0,0 @@
-package manifest
-
-import (
-	"fmt"
-	"net/http"
-	"net/url"
-	"os"
-	"path/filepath"
-	"strings"
-)
-
-func validateTagName(man *Manifest2822, repoName, tagName string) error {
-	if tagName != "" && (man.GetTag(tagName) == nil && len(man.GetSharedTag(tagName)) == 0) {
-		return fmt.Errorf("tag not found in manifest for %q: %q", repoName, tagName)
-	}
-	return nil
-}
-
-// "library" is the default "library directory"
-// returns the parsed version of (in order):
-//   if "repo" is a URL, the remote contents of that URL
-//   if "repo" is a relative path like "./repo", that file
-//   the file "library/repo"
-// (repoName, tagName, man, err)
-func Fetch(library, repo string) (string, string, *Manifest2822, error) {
-	repoName := filepath.Base(repo)
-	tagName := ""
-	if tagIndex := strings.IndexRune(repoName, ':'); tagIndex > 0 {
-		tagName = repoName[tagIndex+1:]
-		repoName = repoName[:tagIndex]
-		repo = strings.TrimSuffix(repo, ":"+tagName)
-	}
-
-	u, err := url.Parse(repo)
-	if err == nil && u.IsAbs() && (u.Scheme == "http" || u.Scheme == "https") {
-		// must be remote URL!
-		resp, err := http.Get(repo)
-		if err != nil {
-			return repoName, tagName, nil, err
-		}
-		defer resp.Body.Close()
-		man, err := Parse(resp.Body)
-		if err != nil {
-			return repoName, tagName, man, err
-		}
-		return repoName, tagName, man, validateTagName(man, repoName, tagName)
-	}
-
-	// try file paths
-	filePaths := []string{}
-	if filepath.IsAbs(repo) || strings.IndexRune(repo, filepath.Separator) >= 0 || strings.IndexRune(repo, '/') >= 0 {
-		filePaths = append(filePaths, repo)
-	}
-	if !filepath.IsAbs(repo) {
-		filePaths = append(filePaths, filepath.Join(library, repo))
-	}
-	for _, fileName := range filePaths {
-		f, err := os.Open(fileName)
-		if err != nil && !os.IsNotExist(err) {
-			return repoName, tagName, nil, err
-		}
-		if err == nil {
-			defer f.Close()
-			man, err := Parse(f)
-			if err != nil {
-				return repoName, tagName, man, err
-			}
-			return repoName, tagName, man, validateTagName(man, repoName, tagName)
-		}
-	}
-
-	return repoName, tagName, nil, fmt.Errorf("unable to find a manifest named %q (in %q or as a remote URL)", repo, library)
-}

+ 0 - 91
bashbrew/go/vendor/github.com/docker-library/go-dockerlibrary/manifest/line-based.go

@@ -1,91 +0,0 @@
-package manifest
-
-import (
-	"bufio"
-	"fmt"
-	"io"
-	"strings"
-)
-
-const DefaultLineBasedFetch = "refs/heads/*" // backwards compatibility
-
-// TODO write more of a proper parser? (probably not worthwhile given that 2822 is the preferred format)
-func ParseLineBasedLine(line string, defaults Manifest2822Entry) (*Manifest2822Entry, error) {
-	entry := defaults.Clone()
-
-	parts := strings.SplitN(line, ":", 2)
-	if len(parts) < 2 {
-		return nil, fmt.Errorf("manifest line missing ':': %s", line)
-	}
-	entry.Tags = []string{strings.TrimSpace(parts[0])}
-
-	parts = strings.SplitN(parts[1], "@", 2)
-	if len(parts) < 2 {
-		return nil, fmt.Errorf("manifest line missing '@': %s", line)
-	}
-	entry.GitRepo = strings.TrimSpace(parts[0])
-
-	parts = strings.SplitN(parts[1], " ", 2)
-	entry.GitCommit = strings.TrimSpace(parts[0])
-	if len(parts) > 1 {
-		entry.Directory = strings.TrimSpace(parts[1])
-	}
-
-	if entry.GitFetch == DefaultLineBasedFetch && !GitCommitRegex.MatchString(entry.GitCommit) {
-		// doesn't look like a commit, must be a tag
-		entry.GitFetch = "refs/tags/" + entry.GitCommit
-		entry.GitCommit = "FETCH_HEAD"
-	}
-
-	return &entry, nil
-}
-
-func ParseLineBased(readerIn io.Reader) (*Manifest2822, error) {
-	reader := bufio.NewReader(readerIn)
-
-	manifest := &Manifest2822{
-		Global: DefaultManifestEntry.Clone(),
-	}
-	manifest.Global.GitFetch = DefaultLineBasedFetch
-
-	for {
-		line, err := reader.ReadString('\n')
-
-		line = strings.TrimSpace(line)
-		if len(line) > 0 {
-			if line[0] == '#' {
-				maintainerLine := strings.TrimPrefix(line, "# maintainer: ")
-				if line != maintainerLine {
-					// if the prefix was removed, it must be a maintainer line!
-					manifest.Global.Maintainers = append(manifest.Global.Maintainers, maintainerLine)
-				}
-			} else {
-				entry, parseErr := ParseLineBasedLine(line, manifest.Global)
-				if parseErr != nil {
-					return nil, parseErr
-				}
-
-				err = manifest.AddEntry(*entry)
-				if err != nil {
-					return nil, err
-				}
-			}
-		}
-
-		if err == io.EOF {
-			break
-		}
-		if err != nil {
-			return nil, err
-		}
-	}
-
-	if len(manifest.Global.Maintainers) < 1 {
-		return nil, fmt.Errorf("missing Maintainers")
-	}
-	if invalidMaintainers := manifest.Global.InvalidMaintainers(); len(invalidMaintainers) > 0 {
-		return nil, fmt.Errorf("invalid Maintainers: %q (expected format %q)", strings.Join(invalidMaintainers, ", "), MaintainersFormat)
-	}
-
-	return manifest, nil
-}

+ 0 - 24
bashbrew/go/vendor/github.com/docker-library/go-dockerlibrary/manifest/parse.go

@@ -1,24 +0,0 @@
-package manifest
-
-import (
-	"bytes"
-	"fmt"
-	"io"
-)
-
-// try parsing as a 2822 manifest, but fallback to line-based if that fails
-func Parse(reader io.Reader) (*Manifest2822, error) {
-	buf := &bytes.Buffer{}
-
-	// try parsing as 2822, but also copy back into a new buffer so that if it fails, we can re-parse as line-based
-	manifest, err2822 := Parse2822(io.TeeReader(reader, buf))
-	if err2822 != nil {
-		manifest, err := ParseLineBased(buf)
-		if err != nil {
-			return nil, fmt.Errorf("cannot parse manifest in either format:\nRFC 2822 error: %v\nLine-based error: %v", err2822, err)
-		}
-		return manifest, nil
-	}
-
-	return manifest, nil
-}

+ 0 - 608
bashbrew/go/vendor/github.com/docker-library/go-dockerlibrary/manifest/rfc2822.go

@@ -1,608 +0,0 @@
-package manifest
-
-import (
-	"bufio"
-	"fmt"
-	"io"
-	"path"
-	"regexp"
-	"sort"
-	"strings"
-
-	"github.com/docker-library/go-dockerlibrary/architecture"
-	"github.com/docker-library/go-dockerlibrary/pkg/stripper"
-
-	"pault.ag/go/debian/control"
-)
-
-var (
-	GitCommitRegex = regexp.MustCompile(`^[0-9a-f]{1,64}$`)
-	GitFetchRegex  = regexp.MustCompile(`^refs/(heads|tags)/[^*?:]+$`)
-
-	// https://github.com/docker/distribution/blob/v2.7.1/reference/regexp.go#L37
-	ValidTagRegex = regexp.MustCompile(`^\w[\w.-]{0,127}$`)
-)
-
-type Manifest2822 struct {
-	Global  Manifest2822Entry
-	Entries []Manifest2822Entry
-}
-
-type Manifest2822Entry struct {
-	control.Paragraph
-
-	Maintainers []string `delim:"," strip:"\n\r\t "`
-
-	Tags       []string `delim:"," strip:"\n\r\t "`
-	SharedTags []string `delim:"," strip:"\n\r\t "`
-
-	Architectures []string `delim:"," strip:"\n\r\t "`
-
-	GitRepo   string
-	GitFetch  string
-	GitCommit string
-	Directory string
-	File      string
-
-	// architecture-specific versions of the above fields
-	ArchValues map[string]string
-	// "ARCH-FIELD: VALUE"
-	// ala, "s390x-GitCommit: deadbeef"
-	// (sourced from Paragraph.Values via .SeedArchValues())
-
-	Constraints []string `delim:"," strip:"\n\r\t "`
-}
-
-var (
-	DefaultArchitecture = "amd64"
-
-	DefaultManifestEntry = Manifest2822Entry{
-		Architectures: []string{DefaultArchitecture},
-
-		GitFetch:  "refs/heads/master",
-		Directory: ".",
-		File:      "Dockerfile",
-	}
-)
-
-func deepCopyStringsMap(a map[string]string) map[string]string {
-	b := map[string]string{}
-	for k, v := range a {
-		b[k] = v
-	}
-	return b
-}
-
-func (entry Manifest2822Entry) Clone() Manifest2822Entry {
-	// SLICES! grr
-	entry.Maintainers = append([]string{}, entry.Maintainers...)
-	entry.Tags = append([]string{}, entry.Tags...)
-	entry.SharedTags = append([]string{}, entry.SharedTags...)
-	entry.Architectures = append([]string{}, entry.Architectures...)
-	entry.Constraints = append([]string{}, entry.Constraints...)
-	// and MAPS, oh my
-	entry.ArchValues = deepCopyStringsMap(entry.ArchValues)
-	return entry
-}
-
-func (entry *Manifest2822Entry) SeedArchValues() {
-	for field, val := range entry.Paragraph.Values {
-		if strings.HasSuffix(field, "-GitRepo") || strings.HasSuffix(field, "-GitFetch") || strings.HasSuffix(field, "-GitCommit") || strings.HasSuffix(field, "-Directory") || strings.HasSuffix(field, "-File") {
-			entry.ArchValues[field] = val
-		}
-	}
-}
-func (entry *Manifest2822Entry) CleanDirectoryValues() {
-	entry.Directory = path.Clean(entry.Directory)
-	for field, val := range entry.ArchValues {
-		if strings.HasSuffix(field, "-Directory") && val != "" {
-			entry.ArchValues[field] = path.Clean(val)
-		}
-	}
-}
-
-const StringSeparator2822 = ", "
-
-func (entry Manifest2822Entry) MaintainersString() string {
-	return strings.Join(entry.Maintainers, StringSeparator2822)
-}
-
-func (entry Manifest2822Entry) TagsString() string {
-	return strings.Join(entry.Tags, StringSeparator2822)
-}
-
-func (entry Manifest2822Entry) SharedTagsString() string {
-	return strings.Join(entry.SharedTags, StringSeparator2822)
-}
-
-func (entry Manifest2822Entry) ArchitecturesString() string {
-	return strings.Join(entry.Architectures, StringSeparator2822)
-}
-
-func (entry Manifest2822Entry) ConstraintsString() string {
-	return strings.Join(entry.Constraints, StringSeparator2822)
-}
-
-// if this method returns "true", then a.Tags and b.Tags can safely be combined (for the purposes of building)
-func (a Manifest2822Entry) SameBuildArtifacts(b Manifest2822Entry) bool {
-	// check xxxarch-GitRepo, etc. fields for sameness first
-	for _, key := range append(a.archFields(), b.archFields()...) {
-		if a.ArchValues[key] != b.ArchValues[key] {
-			return false
-		}
-	}
-
-	return a.ArchitecturesString() == b.ArchitecturesString() && a.GitRepo == b.GitRepo && a.GitFetch == b.GitFetch && a.GitCommit == b.GitCommit && a.Directory == b.Directory && a.File == b.File && a.ConstraintsString() == b.ConstraintsString()
-}
-
-// returns a list of architecture-specific fields in an Entry
-func (entry Manifest2822Entry) archFields() []string {
-	ret := []string{}
-	for key, val := range entry.ArchValues {
-		if val != "" {
-			ret = append(ret, key)
-		}
-	}
-	sort.Strings(ret)
-	return ret
-}
-
-// returns a new Entry with any of the values that are equal to the values in "defaults" cleared
-func (entry Manifest2822Entry) ClearDefaults(defaults Manifest2822Entry) Manifest2822Entry {
-	entry = entry.Clone() // make absolutely certain we have a deep clone
-	if entry.MaintainersString() == defaults.MaintainersString() {
-		entry.Maintainers = nil
-	}
-	if entry.TagsString() == defaults.TagsString() {
-		entry.Tags = nil
-	}
-	if entry.SharedTagsString() == defaults.SharedTagsString() {
-		entry.SharedTags = nil
-	}
-	if entry.ArchitecturesString() == defaults.ArchitecturesString() {
-		entry.Architectures = nil
-	}
-	if entry.GitRepo == defaults.GitRepo {
-		entry.GitRepo = ""
-	}
-	if entry.GitFetch == defaults.GitFetch {
-		entry.GitFetch = ""
-	}
-	if entry.GitCommit == defaults.GitCommit {
-		entry.GitCommit = ""
-	}
-	if entry.Directory == defaults.Directory {
-		entry.Directory = ""
-	}
-	if entry.File == defaults.File {
-		entry.File = ""
-	}
-	for _, key := range defaults.archFields() {
-		if defaults.ArchValues[key] == entry.ArchValues[key] {
-			delete(entry.ArchValues, key)
-		}
-	}
-	if entry.ConstraintsString() == defaults.ConstraintsString() {
-		entry.Constraints = nil
-	}
-	return entry
-}
-
-func (entry Manifest2822Entry) String() string {
-	ret := []string{}
-	if str := entry.MaintainersString(); str != "" {
-		ret = append(ret, "Maintainers: "+str)
-	}
-	if str := entry.TagsString(); str != "" {
-		ret = append(ret, "Tags: "+str)
-	}
-	if str := entry.SharedTagsString(); str != "" {
-		ret = append(ret, "SharedTags: "+str)
-	}
-	if str := entry.ArchitecturesString(); str != "" {
-		ret = append(ret, "Architectures: "+str)
-	}
-	if str := entry.GitRepo; str != "" {
-		ret = append(ret, "GitRepo: "+str)
-	}
-	if str := entry.GitFetch; str != "" {
-		ret = append(ret, "GitFetch: "+str)
-	}
-	if str := entry.GitCommit; str != "" {
-		ret = append(ret, "GitCommit: "+str)
-	}
-	if str := entry.Directory; str != "" {
-		ret = append(ret, "Directory: "+str)
-	}
-	if str := entry.File; str != "" {
-		ret = append(ret, "File: "+str)
-	}
-	for _, key := range entry.archFields() {
-		ret = append(ret, key+": "+entry.ArchValues[key])
-	}
-	if str := entry.ConstraintsString(); str != "" {
-		ret = append(ret, "Constraints: "+str)
-	}
-	return strings.Join(ret, "\n")
-}
-
-func (manifest Manifest2822) String() string {
-	entries := []Manifest2822Entry{manifest.Global.ClearDefaults(DefaultManifestEntry)}
-	entries = append(entries, manifest.Entries...)
-
-	ret := []string{}
-	for i, entry := range entries {
-		if i > 0 {
-			entry = entry.ClearDefaults(manifest.Global)
-		}
-		ret = append(ret, entry.String())
-	}
-
-	return strings.Join(ret, "\n\n")
-}
-
-func (entry *Manifest2822Entry) SetGitRepo(arch string, repo string) {
-	if entry.ArchValues == nil {
-		entry.ArchValues = map[string]string{}
-	}
-	entry.ArchValues[arch+"-GitRepo"] = repo
-}
-
-func (entry Manifest2822Entry) ArchGitRepo(arch string) string {
-	if val, ok := entry.ArchValues[arch+"-GitRepo"]; ok && val != "" {
-		return val
-	}
-	return entry.GitRepo
-}
-
-func (entry Manifest2822Entry) ArchGitFetch(arch string) string {
-	if val, ok := entry.ArchValues[arch+"-GitFetch"]; ok && val != "" {
-		return val
-	}
-	return entry.GitFetch
-}
-
-func (entry *Manifest2822Entry) SetGitCommit(arch string, commit string) {
-	if entry.ArchValues == nil {
-		entry.ArchValues = map[string]string{}
-	}
-	entry.ArchValues[arch+"-GitCommit"] = commit
-}
-
-func (entry Manifest2822Entry) ArchGitCommit(arch string) string {
-	if val, ok := entry.ArchValues[arch+"-GitCommit"]; ok && val != "" {
-		return val
-	}
-	return entry.GitCommit
-}
-
-func (entry Manifest2822Entry) ArchDirectory(arch string) string {
-	if val, ok := entry.ArchValues[arch+"-Directory"]; ok && val != "" {
-		return val
-	}
-	return entry.Directory
-}
-
-func (entry Manifest2822Entry) ArchFile(arch string) string {
-	if val, ok := entry.ArchValues[arch+"-File"]; ok && val != "" {
-		return val
-	}
-	return entry.File
-}
-
-func (entry Manifest2822Entry) HasTag(tag string) bool {
-	for _, existingTag := range entry.Tags {
-		if tag == existingTag {
-			return true
-		}
-	}
-	return false
-}
-
-// HasSharedTag returns true if the given tag exists in entry.SharedTags.
-func (entry Manifest2822Entry) HasSharedTag(tag string) bool {
-	for _, existingTag := range entry.SharedTags {
-		if tag == existingTag {
-			return true
-		}
-	}
-	return false
-}
-
-// HasArchitecture returns true if the given architecture exists in entry.Architectures
-func (entry Manifest2822Entry) HasArchitecture(arch string) bool {
-	for _, existingArch := range entry.Architectures {
-		if arch == existingArch {
-			return true
-		}
-	}
-	return false
-}
-
-func (manifest Manifest2822) GetTag(tag string) *Manifest2822Entry {
-	for i, entry := range manifest.Entries {
-		if entry.HasTag(tag) {
-			return &manifest.Entries[i]
-		}
-	}
-	return nil
-}
-
-// GetSharedTag returns a list of entries with the given tag in entry.SharedTags (or the empty list if there are no entries with the given tag).
-func (manifest Manifest2822) GetSharedTag(tag string) []*Manifest2822Entry {
-	ret := []*Manifest2822Entry{}
-	for i, entry := range manifest.Entries {
-		if entry.HasSharedTag(tag) {
-			ret = append(ret, &manifest.Entries[i])
-		}
-	}
-	return ret
-}
-
-// GetAllSharedTags returns a list of the sum of all SharedTags in all entries of this image manifest (in the order they appear in the file).
-func (manifest Manifest2822) GetAllSharedTags() []string {
-	fakeEntry := Manifest2822Entry{}
-	for _, entry := range manifest.Entries {
-		fakeEntry.SharedTags = append(fakeEntry.SharedTags, entry.SharedTags...)
-	}
-	fakeEntry.DeduplicateSharedTags()
-	return fakeEntry.SharedTags
-}
-
-type SharedTagGroup struct {
-	SharedTags []string
-	Entries    []*Manifest2822Entry
-}
-
-// GetSharedTagGroups returns a map of shared tag groups to the list of entries they share (as described in https://github.com/docker-library/go-dockerlibrary/pull/2#issuecomment-277853597).
-func (manifest Manifest2822) GetSharedTagGroups() []SharedTagGroup {
-	inter := map[string][]string{}
-	interOrder := []string{} // order matters, and maps randomize order
-	interKeySep := ","
-	for _, sharedTag := range manifest.GetAllSharedTags() {
-		interKeyParts := []string{}
-		for _, entry := range manifest.GetSharedTag(sharedTag) {
-			interKeyParts = append(interKeyParts, entry.Tags[0])
-		}
-		interKey := strings.Join(interKeyParts, interKeySep)
-		if _, ok := inter[interKey]; !ok {
-			interOrder = append(interOrder, interKey)
-		}
-		inter[interKey] = append(inter[interKey], sharedTag)
-	}
-	ret := []SharedTagGroup{}
-	for _, tags := range interOrder {
-		group := SharedTagGroup{
-			SharedTags: inter[tags],
-			Entries:    []*Manifest2822Entry{},
-		}
-		for _, tag := range strings.Split(tags, interKeySep) {
-			group.Entries = append(group.Entries, manifest.GetTag(tag))
-		}
-		ret = append(ret, group)
-	}
-	return ret
-}
-
-func (manifest *Manifest2822) AddEntry(entry Manifest2822Entry) error {
-	if len(entry.Tags) < 1 {
-		return fmt.Errorf("missing Tags")
-	}
-	if entry.GitRepo == "" || entry.GitFetch == "" || entry.GitCommit == "" {
-		return fmt.Errorf("Tags %q missing one of GitRepo, GitFetch, or GitCommit", entry.TagsString())
-	}
-	if invalidMaintainers := entry.InvalidMaintainers(); len(invalidMaintainers) > 0 {
-		return fmt.Errorf("Tags %q has invalid Maintainers: %q (expected format %q)", entry.TagsString(), strings.Join(invalidMaintainers, ", "), MaintainersFormat)
-	}
-
-	entry.DeduplicateSharedTags()
-	entry.CleanDirectoryValues()
-
-	if invalidTags := entry.InvalidTags(); len(invalidTags) > 0 {
-		return fmt.Errorf("Tags %q has invalid (Shared)Tags: %q", entry.TagsString(), strings.Join(invalidTags, ", "))
-	}
-	if invalidArchitectures := entry.InvalidArchitectures(); len(invalidArchitectures) > 0 {
-		return fmt.Errorf("Tags %q has invalid Architectures: %q", entry.TagsString(), strings.Join(invalidArchitectures, ", "))
-	}
-
-	seenTag := map[string]bool{}
-	for _, tag := range entry.Tags {
-		if otherEntry := manifest.GetTag(tag); otherEntry != nil {
-			return fmt.Errorf("Tags %q includes duplicate tag: %q (duplicated in %q)", entry.TagsString(), tag, otherEntry.TagsString())
-		}
-		if otherEntries := manifest.GetSharedTag(tag); len(otherEntries) > 0 {
-			return fmt.Errorf("Tags %q includes tag conflicting with a shared tag: %q (shared tag in %q)", entry.TagsString(), tag, otherEntries[0].TagsString())
-		}
-		if seenTag[tag] {
-			return fmt.Errorf("Tags %q includes duplicate tag: %q", entry.TagsString(), tag)
-		}
-		seenTag[tag] = true
-	}
-	for _, tag := range entry.SharedTags {
-		if otherEntry := manifest.GetTag(tag); otherEntry != nil {
-			return fmt.Errorf("Tags %q includes conflicting shared tag: %q (duplicated in %q)", entry.TagsString(), tag, otherEntry.TagsString())
-		}
-		if seenTag[tag] {
-			return fmt.Errorf("Tags %q includes duplicate tag: %q (in SharedTags)", entry.TagsString(), tag)
-		}
-		seenTag[tag] = true
-	}
-
-	for i, existingEntry := range manifest.Entries {
-		if existingEntry.SameBuildArtifacts(entry) {
-			manifest.Entries[i].Tags = append(existingEntry.Tags, entry.Tags...)
-			manifest.Entries[i].SharedTags = append(existingEntry.SharedTags, entry.SharedTags...)
-			manifest.Entries[i].DeduplicateSharedTags()
-			return nil
-		}
-	}
-
-	manifest.Entries = append(manifest.Entries, entry)
-
-	return nil
-}
-
-const (
-	MaintainersNameRegex   = `[^\s<>()][^<>()]*`
-	MaintainersEmailRegex  = `[^\s<>()]+`
-	MaintainersGitHubRegex = `[^\s<>()]+`
-
-	MaintainersFormat = `Full Name <contact-email-or-url> (@github-handle) OR Full Name (@github-handle)`
-)
-
-var (
-	MaintainersRegex = regexp.MustCompile(`^(` + MaintainersNameRegex + `)(?:\s+<(` + MaintainersEmailRegex + `)>)?\s+[(]@(` + MaintainersGitHubRegex + `)[)]$`)
-)
-
-func (entry Manifest2822Entry) InvalidMaintainers() []string {
-	invalid := []string{}
-	for _, maintainer := range entry.Maintainers {
-		if !MaintainersRegex.MatchString(maintainer) {
-			invalid = append(invalid, maintainer)
-		}
-	}
-	return invalid
-}
-
-func (entry Manifest2822Entry) InvalidTags() []string {
-	invalid := []string{}
-	for _, tag := range append(append([]string{}, entry.Tags...), entry.SharedTags...) {
-		if !ValidTagRegex.MatchString(tag) {
-			invalid = append(invalid, tag)
-		}
-	}
-	return invalid
-}
-
-func (entry Manifest2822Entry) InvalidArchitectures() []string {
-	invalid := []string{}
-	for _, arch := range entry.Architectures {
-		if _, ok := architecture.SupportedArches[arch]; !ok {
-			invalid = append(invalid, arch)
-		}
-	}
-	return invalid
-}
-
-// DeduplicateSharedTags will remove duplicate values from entry.SharedTags, preserving order.
-func (entry *Manifest2822Entry) DeduplicateSharedTags() {
-	aggregate := []string{}
-	seen := map[string]bool{}
-	for _, tag := range entry.SharedTags {
-		if seen[tag] {
-			continue
-		}
-		seen[tag] = true
-		aggregate = append(aggregate, tag)
-	}
-	entry.SharedTags = aggregate
-}
-
-// DeduplicateArchitectures will remove duplicate values from entry.Architectures and sort the result.
-func (entry *Manifest2822Entry) DeduplicateArchitectures() {
-	aggregate := []string{}
-	seen := map[string]bool{}
-	for _, arch := range entry.Architectures {
-		if seen[arch] {
-			continue
-		}
-		seen[arch] = true
-		aggregate = append(aggregate, arch)
-	}
-	sort.Strings(aggregate)
-	entry.Architectures = aggregate
-}
-
-type decoderWrapper struct {
-	*control.Decoder
-}
-
-func (decoder *decoderWrapper) Decode(entry *Manifest2822Entry) error {
-	// reset Architectures and SharedTags so that they can be either inherited or replaced, not additive
-	sharedTags := entry.SharedTags
-	entry.SharedTags = nil
-	arches := entry.Architectures
-	entry.Architectures = nil
-
-	for {
-		err := decoder.Decoder.Decode(entry)
-		if err != nil {
-			return err
-		}
-
-		// ignore empty paragraphs (blank lines at the start, excess blank lines between paragraphs, excess blank lines at EOF)
-		if len(entry.Paragraph.Order) == 0 {
-			continue
-		}
-
-		// if we had no SharedTags or Architectures, restore our "default" (original) values
-		if len(entry.SharedTags) == 0 {
-			entry.SharedTags = sharedTags
-		}
-		if len(entry.Architectures) == 0 {
-			entry.Architectures = arches
-		}
-		entry.DeduplicateArchitectures()
-
-		// pull out any new architecture-specific values from Paragraph.Values
-		entry.SeedArchValues()
-
-		return nil
-	}
-}
-
-func Parse2822(readerIn io.Reader) (*Manifest2822, error) {
-	reader := stripper.NewCommentStripper(readerIn)
-
-	realDecoder, err := control.NewDecoder(bufio.NewReader(reader), nil)
-	if err != nil {
-		return nil, err
-	}
-	decoder := decoderWrapper{realDecoder}
-
-	manifest := Manifest2822{
-		Global: DefaultManifestEntry.Clone(),
-	}
-
-	if err := decoder.Decode(&manifest.Global); err != nil {
-		return nil, err
-	}
-	if len(manifest.Global.Maintainers) < 1 {
-		return nil, fmt.Errorf("missing Maintainers")
-	}
-	if invalidMaintainers := manifest.Global.InvalidMaintainers(); len(invalidMaintainers) > 0 {
-		return nil, fmt.Errorf("invalid Maintainers: %q (expected format %q)", strings.Join(invalidMaintainers, ", "), MaintainersFormat)
-	}
-	if len(manifest.Global.Tags) > 0 {
-		return nil, fmt.Errorf("global Tags not permitted")
-	}
-	if invalidArchitectures := manifest.Global.InvalidArchitectures(); len(invalidArchitectures) > 0 {
-		return nil, fmt.Errorf("invalid global Architectures: %q", strings.Join(invalidArchitectures, ", "))
-	}
-
-	for {
-		entry := manifest.Global.Clone()
-
-		err := decoder.Decode(&entry)
-		if err == io.EOF {
-			break
-		}
-		if err != nil {
-			return nil, err
-		}
-
-		if !GitFetchRegex.MatchString(entry.GitFetch) {
-			return nil, fmt.Errorf(`Tags %q has invalid GitFetch (must be "refs/heads/..." or "refs/tags/..."): %q`, entry.TagsString(), entry.GitFetch)
-		}
-		if !GitCommitRegex.MatchString(entry.GitCommit) {
-			return nil, fmt.Errorf(`Tags %q has invalid GitCommit (must be a commit, not a tag or ref): %q`, entry.TagsString(), entry.GitCommit)
-		}
-
-		err = manifest.AddEntry(entry)
-		if err != nil {
-			return nil, err
-		}
-	}
-
-	return &manifest, nil
-}

+ 0 - 42
bashbrew/go/vendor/github.com/docker-library/go-dockerlibrary/pkg/execpipe/execpipe.go

@@ -1,42 +0,0 @@
-package execpipe
-
-import (
-	"io"
-	"os/exec"
-)
-
-// "io.ReadCloser" interface to a command's output where "Close()" is effectively "Wait()"
-type Pipe struct {
-	cmd *exec.Cmd
-	out io.ReadCloser
-}
-
-// convenience wrapper for "Run"
-func RunCommand(cmd string, args ...string) (*Pipe, error) {
-	return Run(exec.Command(cmd, args...))
-}
-
-// start "cmd", capturing stdout in a pipe (be sure to call "Close" when finished reading to reap the process)
-func Run(cmd *exec.Cmd) (*Pipe, error) {
-	pipe := &Pipe{
-		cmd: cmd,
-	}
-	if out, err := pipe.cmd.StdoutPipe(); err != nil {
-		return nil, err
-	} else {
-		pipe.out = out
-	}
-	if err := pipe.cmd.Start(); err != nil {
-		pipe.out.Close()
-		return nil, err
-	}
-	return pipe, nil
-}
-
-func (pipe *Pipe) Read(p []byte) (n int, err error) {
-	return pipe.out.Read(p)
-}
-
-func (pipe *Pipe) Close() error {
-	return pipe.cmd.Wait()
-}

+ 0 - 54
bashbrew/go/vendor/github.com/docker-library/go-dockerlibrary/pkg/stripper/comments.go

@@ -1,54 +0,0 @@
-package stripper
-
-import (
-	"bufio"
-	"bytes"
-	"io"
-	"strings"
-	"unicode"
-)
-
-type CommentStripper struct {
-	Comment    string
-	Delimiter  byte
-	Whitespace bool
-
-	r   *bufio.Reader
-	buf bytes.Buffer
-}
-
-func NewCommentStripper(r io.Reader) *CommentStripper {
-	return &CommentStripper{
-		Comment:    "#",
-		Delimiter:  '\n',
-		Whitespace: true,
-
-		r: bufio.NewReader(r),
-	}
-}
-
-func (r *CommentStripper) Read(p []byte) (int, error) {
-	for {
-		if r.buf.Len() >= len(p) {
-			return r.buf.Read(p)
-		}
-		line, err := r.r.ReadString(r.Delimiter)
-		if len(line) > 0 {
-			checkLine := line
-			if r.Whitespace {
-				checkLine = strings.TrimLeftFunc(checkLine, unicode.IsSpace)
-			}
-			if strings.HasPrefix(checkLine, r.Comment) {
-				// yay, skip this line
-				continue
-			}
-			r.buf.WriteString(line)
-		}
-		if err != nil {
-			if r.buf.Len() > 0 {
-				return r.buf.Read(p)
-			}
-			return 0, err
-		}
-	}
-}

+ 0 - 8
bashbrew/go/vendor/github.com/docker-library/go-dockerlibrary/pkg/templatelib/doc.go

@@ -1,8 +0,0 @@
-/*
-Package templatelib implements a group of useful functions for use with the stdlib text/template package.
-
-Usage:
-
-	tmpl, err := template.New("some-template").Funcs(templatelib.FuncMap).Parse("Hi, {{ join " " .Names }}")
-*/
-package templatelib

+ 0 - 138
bashbrew/go/vendor/github.com/docker-library/go-dockerlibrary/pkg/templatelib/lib.go

@@ -1,138 +0,0 @@
-package templatelib
-
-import (
-	"encoding/json"
-	"fmt"
-	"os"
-	"reflect"
-	"strings"
-	"text/template"
-)
-
-func swapStringsFuncBoolArgsOrder(a func(string, string) bool) func(string, string) bool {
-	return func(str1 string, str2 string) bool {
-		return a(str2, str1)
-	}
-}
-
-func thingsActionFactory(name string, actOnFirst bool, action func([]interface{}, interface{}) interface{}) func(args ...interface{}) interface{} {
-	return func(args ...interface{}) interface{} {
-		if len(args) < 1 {
-			panic(fmt.Sprintf(`%q requires at least one argument`, name))
-		}
-
-		actArgs := []interface{}{}
-		for _, val := range args {
-			v := reflect.ValueOf(val)
-
-			switch v.Kind() {
-			case reflect.Slice, reflect.Array:
-				for i := 0; i < v.Len(); i++ {
-					actArgs = append(actArgs, v.Index(i).Interface())
-				}
-			default:
-				actArgs = append(actArgs, v.Interface())
-			}
-		}
-
-		var arg interface{}
-		if actOnFirst {
-			arg = actArgs[0]
-			actArgs = actArgs[1:]
-		} else {
-			arg = actArgs[len(actArgs)-1]
-			actArgs = actArgs[:len(actArgs)-1]
-		}
-
-		return action(actArgs, arg)
-	}
-}
-
-func stringsActionFactory(name string, actOnFirst bool, action func([]string, string) string) func(args ...interface{}) interface{} {
-	return thingsActionFactory(name, actOnFirst, func(args []interface{}, arg interface{}) interface{} {
-		str := arg.(string)
-		strs := []string{}
-		for _, val := range args {
-			strs = append(strs, val.(string))
-		}
-		return action(strs, str)
-	})
-}
-
-func stringsModifierActionFactory(a func(string, string) string) func([]string, string) string {
-	return func(strs []string, str string) string {
-		for _, mod := range strs {
-			str = a(str, mod)
-		}
-		return str
-	}
-}
-
-var FuncMap = template.FuncMap{
-	// {{- $isGitHub := hasPrefix "https://github.com/" $url -}}
-	// {{- $isHtml := hasSuffix ".html" $url -}}
-	"hasPrefix": swapStringsFuncBoolArgsOrder(strings.HasPrefix),
-	"hasSuffix": swapStringsFuncBoolArgsOrder(strings.HasSuffix),
-
-	// {{- $hugeIfTrue := .SomeValue | ternary "HUGE" "not so huge" -}}
-	// if .SomeValue is truthy, $hugeIfTrue will be "HUGE"
-	// (otherwise, "not so huge")
-	"ternary": func(truthy interface{}, falsey interface{}, val interface{}) interface{} {
-		if t, ok := template.IsTrue(val); !ok {
-			panic(fmt.Sprintf(`template.IsTrue(%+v) says things are NOT OK`, val))
-		} else if t {
-			return truthy
-		} else {
-			return falsey
-		}
-	},
-
-	// First Tag: {{- .Tags | first -}}
-	// Last Tag:  {{- .Tags | last -}}
-	"first": thingsActionFactory("first", true, func(args []interface{}, arg interface{}) interface{} { return arg }),
-	"last":  thingsActionFactory("last", false, func(args []interface{}, arg interface{}) interface{} { return arg }),
-
-	// JSON data dump: {{ json . }}
-	// (especially nice for taking data and piping it to "jq")
-	// (ie "some-tool inspect --format '{{ json . }}' some-things | jq .")
-	"json": func(v interface{}) (string, error) {
-		j, err := json.Marshal(v)
-		return string(j), err
-	},
-
-	// Everybody: {{- join ", " .Names -}}
-	// Concat: {{- join "/" "https://github.com" "jsmith" "some-repo" -}}
-	"join": stringsActionFactory("join", true, strings.Join),
-
-	// {{- $mungedUrl := $url | replace "git://" "https://" | trimSuffixes ".git" -}}
-	// turns: git://github.com/jsmith/some-repo.git
-	// into: https://github.com/jsmith/some-repo
-	"trimPrefixes": stringsActionFactory("trimPrefixes", false, stringsModifierActionFactory(strings.TrimPrefix)),
-	"trimSuffixes": stringsActionFactory("trimSuffixes", false, stringsModifierActionFactory(strings.TrimSuffix)),
-	"replace": stringsActionFactory("replace", false, func(strs []string, str string) string {
-		return strings.NewReplacer(strs...).Replace(str)
-	}),
-
-	// {{- getenv "PATH" -}}
-	// {{- getenv "HOME" "no HOME set" -}}
-	// {{- getenv "HOME" "is set" "is NOT set (or is empty)" -}}
-	"getenv": thingsActionFactory("getenv", true, func(args []interface{}, arg interface{}) interface{} {
-		var (
-			val                  = os.Getenv(arg.(string))
-			setVal   interface{} = val
-			unsetVal interface{} = ""
-		)
-		if len(args) == 2 {
-			setVal, unsetVal = args[0], args[1]
-		} else if len(args) == 1 {
-			unsetVal = args[0]
-		} else if len(args) != 0 {
-			panic(fmt.Sprintf(`expected between 1 and 3 arguments to "getenv", got %d`, len(args)+1))
-		}
-		if val != "" {
-			return setVal
-		} else {
-			return unsetVal
-		}
-	}),
-}

+ 0 - 41
bashbrew/go/vendor/github.com/emirpasic/gods/LICENSE

@@ -1,41 +0,0 @@
-Copyright (c) 2015, Emir Pasic
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
-* Redistributions of source code must retain the above copyright notice, this
-  list of conditions and the following disclaimer.
-
-* Redistributions in binary form must reproduce the above copyright notice,
-  this list of conditions and the following disclaimer in the documentation
-  and/or other materials provided with the distribution.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
-FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
--------------------------------------------------------------------------------
-
-AVL Tree:
-
-Copyright (c) 2017 Benjamin Scher Purcell <[email protected]>
-
-Permission to use, copy, modify, and distribute this software for any
-purpose with or without fee is hereby granted, provided that the above
-copyright notice and this permission notice appear in all copies.
-
-THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
-OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

+ 0 - 35
bashbrew/go/vendor/github.com/emirpasic/gods/containers/containers.go

@@ -1,35 +0,0 @@
-// Copyright (c) 2015, Emir Pasic. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// Package containers provides core interfaces and functions for data structures.
-//
-// Container is the base interface for all data structures to implement.
-//
-// Iterators provide stateful iterators.
-//
-// Enumerable provides Ruby inspired (each, select, map, find, any?, etc.) container functions.
-//
-// Serialization provides serializers (marshalers) and deserializers (unmarshalers).
-package containers
-
-import "github.com/emirpasic/gods/utils"
-
-// Container is base interface that all data structures implement.
-type Container interface {
-	Empty() bool
-	Size() int
-	Clear()
-	Values() []interface{}
-}
-
-// GetSortedValues returns sorted container's elements with respect to the passed comparator.
-// Does not effect the ordering of elements within the container.
-func GetSortedValues(container Container, comparator utils.Comparator) []interface{} {
-	values := container.Values()
-	if len(values) < 2 {
-		return values
-	}
-	utils.Sort(values, comparator)
-	return values
-}

+ 0 - 61
bashbrew/go/vendor/github.com/emirpasic/gods/containers/enumerable.go

@@ -1,61 +0,0 @@
-// Copyright (c) 2015, Emir Pasic. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package containers
-
-// EnumerableWithIndex provides functions for ordered containers whose values can be fetched by an index.
-type EnumerableWithIndex interface {
-	// Each calls the given function once for each element, passing that element's index and value.
-	Each(func(index int, value interface{}))
-
-	// Map invokes the given function once for each element and returns a
-	// container containing the values returned by the given function.
-	// TODO need help on how to enforce this in containers (don't want to type assert when chaining)
-	// Map(func(index int, value interface{}) interface{}) Container
-
-	// Select returns a new container containing all elements for which the given function returns a true value.
-	// TODO need help on how to enforce this in containers (don't want to type assert when chaining)
-	// Select(func(index int, value interface{}) bool) Container
-
-	// Any passes each element of the container to the given function and
-	// returns true if the function ever returns true for any element.
-	Any(func(index int, value interface{}) bool) bool
-
-	// All passes each element of the container to the given function and
-	// returns true if the function returns true for all elements.
-	All(func(index int, value interface{}) bool) bool
-
-	// Find passes each element of the container to the given function and returns
-	// the first (index,value) for which the function is true or -1,nil otherwise
-	// if no element matches the criteria.
-	Find(func(index int, value interface{}) bool) (int, interface{})
-}
-
-// EnumerableWithKey provides functions for ordered containers whose values whose elements are key/value pairs.
-type EnumerableWithKey interface {
-	// Each calls the given function once for each element, passing that element's key and value.
-	Each(func(key interface{}, value interface{}))
-
-	// Map invokes the given function once for each element and returns a container
-	// containing the values returned by the given function as key/value pairs.
-	// TODO need help on how to enforce this in containers (don't want to type assert when chaining)
-	// Map(func(key interface{}, value interface{}) (interface{}, interface{})) Container
-
-	// Select returns a new container containing all elements for which the given function returns a true value.
-	// TODO need help on how to enforce this in containers (don't want to type assert when chaining)
-	// Select(func(key interface{}, value interface{}) bool) Container
-
-	// Any passes each element of the container to the given function and
-	// returns true if the function ever returns true for any element.
-	Any(func(key interface{}, value interface{}) bool) bool
-
-	// All passes each element of the container to the given function and
-	// returns true if the function returns true for all elements.
-	All(func(key interface{}, value interface{}) bool) bool
-
-	// Find passes each element of the container to the given function and returns
-	// the first (key,value) for which the function is true or nil,nil otherwise if no element
-	// matches the criteria.
-	Find(func(key interface{}, value interface{}) bool) (interface{}, interface{})
-}

+ 0 - 109
bashbrew/go/vendor/github.com/emirpasic/gods/containers/iterator.go

@@ -1,109 +0,0 @@
-// Copyright (c) 2015, Emir Pasic. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package containers
-
-// IteratorWithIndex is stateful iterator for ordered containers whose values can be fetched by an index.
-type IteratorWithIndex interface {
-	// Next moves the iterator to the next element and returns true if there was a next element in the container.
-	// If Next() returns true, then next element's index and value can be retrieved by Index() and Value().
-	// If Next() was called for the first time, then it will point the iterator to the first element if it exists.
-	// Modifies the state of the iterator.
-	Next() bool
-
-	// Value returns the current element's value.
-	// Does not modify the state of the iterator.
-	Value() interface{}
-
-	// Index returns the current element's index.
-	// Does not modify the state of the iterator.
-	Index() int
-
-	// Begin resets the iterator to its initial state (one-before-first)
-	// Call Next() to fetch the first element if any.
-	Begin()
-
-	// First moves the iterator to the first element and returns true if there was a first element in the container.
-	// If First() returns true, then first element's index and value can be retrieved by Index() and Value().
-	// Modifies the state of the iterator.
-	First() bool
-}
-
-// IteratorWithKey is a stateful iterator for ordered containers whose elements are key value pairs.
-type IteratorWithKey interface {
-	// Next moves the iterator to the next element and returns true if there was a next element in the container.
-	// If Next() returns true, then next element's key and value can be retrieved by Key() and Value().
-	// If Next() was called for the first time, then it will point the iterator to the first element if it exists.
-	// Modifies the state of the iterator.
-	Next() bool
-
-	// Value returns the current element's value.
-	// Does not modify the state of the iterator.
-	Value() interface{}
-
-	// Key returns the current element's key.
-	// Does not modify the state of the iterator.
-	Key() interface{}
-
-	// Begin resets the iterator to its initial state (one-before-first)
-	// Call Next() to fetch the first element if any.
-	Begin()
-
-	// First moves the iterator to the first element and returns true if there was a first element in the container.
-	// If First() returns true, then first element's key and value can be retrieved by Key() and Value().
-	// Modifies the state of the iterator.
-	First() bool
-}
-
-// ReverseIteratorWithIndex is stateful iterator for ordered containers whose values can be fetched by an index.
-//
-// Essentially it is the same as IteratorWithIndex, but provides additional:
-//
-// Prev() function to enable traversal in reverse
-//
-// Last() function to move the iterator to the last element.
-//
-// End() function to move the iterator past the last element (one-past-the-end).
-type ReverseIteratorWithIndex interface {
-	// Prev moves the iterator to the previous element and returns true if there was a previous element in the container.
-	// If Prev() returns true, then previous element's index and value can be retrieved by Index() and Value().
-	// Modifies the state of the iterator.
-	Prev() bool
-
-	// End moves the iterator past the last element (one-past-the-end).
-	// Call Prev() to fetch the last element if any.
-	End()
-
-	// Last moves the iterator to the last element and returns true if there was a last element in the container.
-	// If Last() returns true, then last element's index and value can be retrieved by Index() and Value().
-	// Modifies the state of the iterator.
-	Last() bool
-
-	IteratorWithIndex
-}
-
-// ReverseIteratorWithKey is a stateful iterator for ordered containers whose elements are key value pairs.
-//
-// Essentially it is the same as IteratorWithKey, but provides additional:
-//
-// Prev() function to enable traversal in reverse
-//
-// Last() function to move the iterator to the last element.
-type ReverseIteratorWithKey interface {
-	// Prev moves the iterator to the previous element and returns true if there was a previous element in the container.
-	// If Prev() returns true, then previous element's key and value can be retrieved by Key() and Value().
-	// Modifies the state of the iterator.
-	Prev() bool
-
-	// End moves the iterator past the last element (one-past-the-end).
-	// Call Prev() to fetch the last element if any.
-	End()
-
-	// Last moves the iterator to the last element and returns true if there was a last element in the container.
-	// If Last() returns true, then last element's key and value can be retrieved by Key() and Value().
-	// Modifies the state of the iterator.
-	Last() bool
-
-	IteratorWithKey
-}

+ 0 - 17
bashbrew/go/vendor/github.com/emirpasic/gods/containers/serialization.go

@@ -1,17 +0,0 @@
-// Copyright (c) 2015, Emir Pasic. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package containers
-
-// JSONSerializer provides JSON serialization
-type JSONSerializer interface {
-	// ToJSON outputs the JSON representation of containers's elements.
-	ToJSON() ([]byte, error)
-}
-
-// JSONDeserializer provides JSON deserialization
-type JSONDeserializer interface {
-	// FromJSON populates containers's elements from the input JSON representation.
-	FromJSON([]byte) error
-}

+ 0 - 200
bashbrew/go/vendor/github.com/emirpasic/gods/lists/arraylist/arraylist.go

@@ -1,200 +0,0 @@
-// Copyright (c) 2015, Emir Pasic. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// Package arraylist implements the array list.
-//
-// Structure is not thread safe.
-//
-// Reference: https://en.wikipedia.org/wiki/List_%28abstract_data_type%29
-package arraylist
-
-import (
-	"fmt"
-	"github.com/emirpasic/gods/lists"
-	"github.com/emirpasic/gods/utils"
-	"strings"
-)
-
-func assertListImplementation() {
-	var _ lists.List = (*List)(nil)
-}
-
-// List holds the elements in a slice
-type List struct {
-	elements []interface{}
-	size     int
-}
-
-const (
-	growthFactor = float32(2.0)  // growth by 100%
-	shrinkFactor = float32(0.25) // shrink when size is 25% of capacity (0 means never shrink)
-)
-
-// New instantiates a new empty list
-func New() *List {
-	return &List{}
-}
-
-// Add appends a value at the end of the list
-func (list *List) Add(values ...interface{}) {
-	list.growBy(len(values))
-	for _, value := range values {
-		list.elements[list.size] = value
-		list.size++
-	}
-}
-
-// Get returns the element at index.
-// Second return parameter is true if index is within bounds of the array and array is not empty, otherwise false.
-func (list *List) Get(index int) (interface{}, bool) {
-
-	if !list.withinRange(index) {
-		return nil, false
-	}
-
-	return list.elements[index], true
-}
-
-// Remove removes one or more elements from the list with the supplied indices.
-func (list *List) Remove(index int) {
-
-	if !list.withinRange(index) {
-		return
-	}
-
-	list.elements[index] = nil                                    // cleanup reference
-	copy(list.elements[index:], list.elements[index+1:list.size]) // shift to the left by one (slow operation, need ways to optimize this)
-	list.size--
-
-	list.shrink()
-}
-
-// Contains checks if elements (one or more) are present in the set.
-// All elements have to be present in the set for the method to return true.
-// Performance time complexity of n^2.
-// Returns true if no arguments are passed at all, i.e. set is always super-set of empty set.
-func (list *List) Contains(values ...interface{}) bool {
-
-	for _, searchValue := range values {
-		found := false
-		for _, element := range list.elements {
-			if element == searchValue {
-				found = true
-				break
-			}
-		}
-		if !found {
-			return false
-		}
-	}
-	return true
-}
-
-// Values returns all elements in the list.
-func (list *List) Values() []interface{} {
-	newElements := make([]interface{}, list.size, list.size)
-	copy(newElements, list.elements[:list.size])
-	return newElements
-}
-
-// Empty returns true if list does not contain any elements.
-func (list *List) Empty() bool {
-	return list.size == 0
-}
-
-// Size returns number of elements within the list.
-func (list *List) Size() int {
-	return list.size
-}
-
-// Clear removes all elements from the list.
-func (list *List) Clear() {
-	list.size = 0
-	list.elements = []interface{}{}
-}
-
-// Sort sorts values (in-place) using.
-func (list *List) Sort(comparator utils.Comparator) {
-	if len(list.elements) < 2 {
-		return
-	}
-	utils.Sort(list.elements[:list.size], comparator)
-}
-
-// Swap swaps the two values at the specified positions.
-func (list *List) Swap(i, j int) {
-	if list.withinRange(i) && list.withinRange(j) {
-		list.elements[i], list.elements[j] = list.elements[j], list.elements[i]
-	}
-}
-
-// Insert inserts values at specified index position shifting the value at that position (if any) and any subsequent elements to the right.
-// Does not do anything if position is negative or bigger than list's size
-// Note: position equal to list's size is valid, i.e. append.
-func (list *List) Insert(index int, values ...interface{}) {
-
-	if !list.withinRange(index) {
-		// Append
-		if index == list.size {
-			list.Add(values...)
-		}
-		return
-	}
-
-	l := len(values)
-	list.growBy(l)
-	list.size += l
-	// Shift old to right
-	for i := list.size - 1; i >= index+l; i-- {
-		list.elements[i] = list.elements[i-l]
-	}
-	// Insert new
-	for i, value := range values {
-		list.elements[index+i] = value
-	}
-}
-
-// String returns a string representation of container
-func (list *List) String() string {
-	str := "ArrayList\n"
-	values := []string{}
-	for _, value := range list.elements[:list.size] {
-		values = append(values, fmt.Sprintf("%v", value))
-	}
-	str += strings.Join(values, ", ")
-	return str
-}
-
-// Check that the index is within bounds of the list
-func (list *List) withinRange(index int) bool {
-	return index >= 0 && index < list.size
-}
-
-func (list *List) resize(cap int) {
-	newElements := make([]interface{}, cap, cap)
-	copy(newElements, list.elements)
-	list.elements = newElements
-}
-
-// Expand the array if necessary, i.e. capacity will be reached if we add n elements
-func (list *List) growBy(n int) {
-	// When capacity is reached, grow by a factor of growthFactor and add number of elements
-	currentCapacity := cap(list.elements)
-	if list.size+n >= currentCapacity {
-		newCapacity := int(growthFactor * float32(currentCapacity+n))
-		list.resize(newCapacity)
-	}
-}
-
-// Shrink the array if necessary, i.e. when size is shrinkFactor percent of current capacity
-func (list *List) shrink() {
-	if shrinkFactor == 0.0 {
-		return
-	}
-	// Shrink when size is at shrinkFactor * capacity
-	currentCapacity := cap(list.elements)
-	if list.size <= int(float32(currentCapacity)*shrinkFactor) {
-		list.resize(list.size)
-	}
-}

+ 0 - 79
bashbrew/go/vendor/github.com/emirpasic/gods/lists/arraylist/enumerable.go

@@ -1,79 +0,0 @@
-// Copyright (c) 2015, Emir Pasic. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package arraylist
-
-import "github.com/emirpasic/gods/containers"
-
-func assertEnumerableImplementation() {
-	var _ containers.EnumerableWithIndex = (*List)(nil)
-}
-
-// Each calls the given function once for each element, passing that element's index and value.
-func (list *List) Each(f func(index int, value interface{})) {
-	iterator := list.Iterator()
-	for iterator.Next() {
-		f(iterator.Index(), iterator.Value())
-	}
-}
-
-// Map invokes the given function once for each element and returns a
-// container containing the values returned by the given function.
-func (list *List) Map(f func(index int, value interface{}) interface{}) *List {
-	newList := &List{}
-	iterator := list.Iterator()
-	for iterator.Next() {
-		newList.Add(f(iterator.Index(), iterator.Value()))
-	}
-	return newList
-}
-
-// Select returns a new container containing all elements for which the given function returns a true value.
-func (list *List) Select(f func(index int, value interface{}) bool) *List {
-	newList := &List{}
-	iterator := list.Iterator()
-	for iterator.Next() {
-		if f(iterator.Index(), iterator.Value()) {
-			newList.Add(iterator.Value())
-		}
-	}
-	return newList
-}
-
-// Any passes each element of the collection to the given function and
-// returns true if the function ever returns true for any element.
-func (list *List) Any(f func(index int, value interface{}) bool) bool {
-	iterator := list.Iterator()
-	for iterator.Next() {
-		if f(iterator.Index(), iterator.Value()) {
-			return true
-		}
-	}
-	return false
-}
-
-// All passes each element of the collection to the given function and
-// returns true if the function returns true for all elements.
-func (list *List) All(f func(index int, value interface{}) bool) bool {
-	iterator := list.Iterator()
-	for iterator.Next() {
-		if !f(iterator.Index(), iterator.Value()) {
-			return false
-		}
-	}
-	return true
-}
-
-// Find passes each element of the container to the given function and returns
-// the first (index,value) for which the function is true or -1,nil otherwise
-// if no element matches the criteria.
-func (list *List) Find(f func(index int, value interface{}) bool) (int, interface{}) {
-	iterator := list.Iterator()
-	for iterator.Next() {
-		if f(iterator.Index(), iterator.Value()) {
-			return iterator.Index(), iterator.Value()
-		}
-	}
-	return -1, nil
-}

+ 0 - 83
bashbrew/go/vendor/github.com/emirpasic/gods/lists/arraylist/iterator.go

@@ -1,83 +0,0 @@
-// Copyright (c) 2015, Emir Pasic. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package arraylist
-
-import "github.com/emirpasic/gods/containers"
-
-func assertIteratorImplementation() {
-	var _ containers.ReverseIteratorWithIndex = (*Iterator)(nil)
-}
-
-// Iterator holding the iterator's state
-type Iterator struct {
-	list  *List
-	index int
-}
-
-// Iterator returns a stateful iterator whose values can be fetched by an index.
-func (list *List) Iterator() Iterator {
-	return Iterator{list: list, index: -1}
-}
-
-// Next moves the iterator to the next element and returns true if there was a next element in the container.
-// If Next() returns true, then next element's index and value can be retrieved by Index() and Value().
-// If Next() was called for the first time, then it will point the iterator to the first element if it exists.
-// Modifies the state of the iterator.
-func (iterator *Iterator) Next() bool {
-	if iterator.index < iterator.list.size {
-		iterator.index++
-	}
-	return iterator.list.withinRange(iterator.index)
-}
-
-// Prev moves the iterator to the previous element and returns true if there was a previous element in the container.
-// If Prev() returns true, then previous element's index and value can be retrieved by Index() and Value().
-// Modifies the state of the iterator.
-func (iterator *Iterator) Prev() bool {
-	if iterator.index >= 0 {
-		iterator.index--
-	}
-	return iterator.list.withinRange(iterator.index)
-}
-
-// Value returns the current element's value.
-// Does not modify the state of the iterator.
-func (iterator *Iterator) Value() interface{} {
-	return iterator.list.elements[iterator.index]
-}
-
-// Index returns the current element's index.
-// Does not modify the state of the iterator.
-func (iterator *Iterator) Index() int {
-	return iterator.index
-}
-
-// Begin resets the iterator to its initial state (one-before-first)
-// Call Next() to fetch the first element if any.
-func (iterator *Iterator) Begin() {
-	iterator.index = -1
-}
-
-// End moves the iterator past the last element (one-past-the-end).
-// Call Prev() to fetch the last element if any.
-func (iterator *Iterator) End() {
-	iterator.index = iterator.list.size
-}
-
-// First moves the iterator to the first element and returns true if there was a first element in the container.
-// If First() returns true, then first element's index and value can be retrieved by Index() and Value().
-// Modifies the state of the iterator.
-func (iterator *Iterator) First() bool {
-	iterator.Begin()
-	return iterator.Next()
-}
-
-// Last moves the iterator to the last element and returns true if there was a last element in the container.
-// If Last() returns true, then last element's index and value can be retrieved by Index() and Value().
-// Modifies the state of the iterator.
-func (iterator *Iterator) Last() bool {
-	iterator.End()
-	return iterator.Prev()
-}

+ 0 - 29
bashbrew/go/vendor/github.com/emirpasic/gods/lists/arraylist/serialization.go

@@ -1,29 +0,0 @@
-// Copyright (c) 2015, Emir Pasic. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package arraylist
-
-import (
-	"encoding/json"
-	"github.com/emirpasic/gods/containers"
-)
-
-func assertSerializationImplementation() {
-	var _ containers.JSONSerializer = (*List)(nil)
-	var _ containers.JSONDeserializer = (*List)(nil)
-}
-
-// ToJSON outputs the JSON representation of list's elements.
-func (list *List) ToJSON() ([]byte, error) {
-	return json.Marshal(list.elements[:list.size])
-}
-
-// FromJSON populates list's elements from the input JSON representation.
-func (list *List) FromJSON(data []byte) error {
-	err := json.Unmarshal(data, &list.elements)
-	if err == nil {
-		list.size = len(list.elements)
-	}
-	return err
-}

+ 0 - 32
bashbrew/go/vendor/github.com/emirpasic/gods/lists/lists.go

@@ -1,32 +0,0 @@
-// Copyright (c) 2015, Emir Pasic. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// Package lists provides an abstract List interface.
-//
-// In computer science, a list or sequence is an abstract data type that represents an ordered sequence of values, where the same value may occur more than once. An instance of a list is a computer representation of the mathematical concept of a finite sequence; the (potentially) infinite analog of a list is a stream.  Lists are a basic example of containers, as they contain other values. If the same value occurs multiple times, each occurrence is considered a distinct item.
-//
-// Reference: https://en.wikipedia.org/wiki/List_%28abstract_data_type%29
-package lists
-
-import (
-	"github.com/emirpasic/gods/containers"
-	"github.com/emirpasic/gods/utils"
-)
-
-// List interface that all lists implement
-type List interface {
-	Get(index int) (interface{}, bool)
-	Remove(index int)
-	Add(values ...interface{})
-	Contains(values ...interface{}) bool
-	Sort(comparator utils.Comparator)
-	Swap(index1, index2 int)
-	Insert(index int, values ...interface{})
-
-	containers.Container
-	// Empty() bool
-	// Size() int
-	// Clear()
-	// Values() []interface{}
-}

+ 0 - 163
bashbrew/go/vendor/github.com/emirpasic/gods/trees/binaryheap/binaryheap.go

@@ -1,163 +0,0 @@
-// Copyright (c) 2015, Emir Pasic. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// Package binaryheap implements a binary heap backed by array list.
-//
-// Comparator defines this heap as either min or max heap.
-//
-// Structure is not thread safe.
-//
-// References: http://en.wikipedia.org/wiki/Binary_heap
-package binaryheap
-
-import (
-	"fmt"
-	"github.com/emirpasic/gods/lists/arraylist"
-	"github.com/emirpasic/gods/trees"
-	"github.com/emirpasic/gods/utils"
-	"strings"
-)
-
-func assertTreeImplementation() {
-	var _ trees.Tree = (*Heap)(nil)
-}
-
-// Heap holds elements in an array-list
-type Heap struct {
-	list       *arraylist.List
-	Comparator utils.Comparator
-}
-
-// NewWith instantiates a new empty heap tree with the custom comparator.
-func NewWith(comparator utils.Comparator) *Heap {
-	return &Heap{list: arraylist.New(), Comparator: comparator}
-}
-
-// NewWithIntComparator instantiates a new empty heap with the IntComparator, i.e. elements are of type int.
-func NewWithIntComparator() *Heap {
-	return &Heap{list: arraylist.New(), Comparator: utils.IntComparator}
-}
-
-// NewWithStringComparator instantiates a new empty heap with the StringComparator, i.e. elements are of type string.
-func NewWithStringComparator() *Heap {
-	return &Heap{list: arraylist.New(), Comparator: utils.StringComparator}
-}
-
-// Push adds a value onto the heap and bubbles it up accordingly.
-func (heap *Heap) Push(values ...interface{}) {
-	if len(values) == 1 {
-		heap.list.Add(values[0])
-		heap.bubbleUp()
-	} else {
-		// Reference: https://en.wikipedia.org/wiki/Binary_heap#Building_a_heap
-		for _, value := range values {
-			heap.list.Add(value)
-		}
-		size := heap.list.Size()/2 + 1
-		for i := size; i >= 0; i-- {
-			heap.bubbleDownIndex(i)
-		}
-	}
-}
-
-// Pop removes top element on heap and returns it, or nil if heap is empty.
-// Second return parameter is true, unless the heap was empty and there was nothing to pop.
-func (heap *Heap) Pop() (value interface{}, ok bool) {
-	value, ok = heap.list.Get(0)
-	if !ok {
-		return
-	}
-	lastIndex := heap.list.Size() - 1
-	heap.list.Swap(0, lastIndex)
-	heap.list.Remove(lastIndex)
-	heap.bubbleDown()
-	return
-}
-
-// Peek returns top element on the heap without removing it, or nil if heap is empty.
-// Second return parameter is true, unless the heap was empty and there was nothing to peek.
-func (heap *Heap) Peek() (value interface{}, ok bool) {
-	return heap.list.Get(0)
-}
-
-// Empty returns true if heap does not contain any elements.
-func (heap *Heap) Empty() bool {
-	return heap.list.Empty()
-}
-
-// Size returns number of elements within the heap.
-func (heap *Heap) Size() int {
-	return heap.list.Size()
-}
-
-// Clear removes all elements from the heap.
-func (heap *Heap) Clear() {
-	heap.list.Clear()
-}
-
-// Values returns all elements in the heap.
-func (heap *Heap) Values() []interface{} {
-	return heap.list.Values()
-}
-
-// String returns a string representation of container
-func (heap *Heap) String() string {
-	str := "BinaryHeap\n"
-	values := []string{}
-	for _, value := range heap.list.Values() {
-		values = append(values, fmt.Sprintf("%v", value))
-	}
-	str += strings.Join(values, ", ")
-	return str
-}
-
-// Performs the "bubble down" operation. This is to place the element that is at the root
-// of the heap in its correct place so that the heap maintains the min/max-heap order property.
-func (heap *Heap) bubbleDown() {
-	heap.bubbleDownIndex(0)
-}
-
-// Performs the "bubble down" operation. This is to place the element that is at the index
-// of the heap in its correct place so that the heap maintains the min/max-heap order property.
-func (heap *Heap) bubbleDownIndex(index int) {
-	size := heap.list.Size()
-	for leftIndex := index<<1 + 1; leftIndex < size; leftIndex = index<<1 + 1 {
-		rightIndex := index<<1 + 2
-		smallerIndex := leftIndex
-		leftValue, _ := heap.list.Get(leftIndex)
-		rightValue, _ := heap.list.Get(rightIndex)
-		if rightIndex < size && heap.Comparator(leftValue, rightValue) > 0 {
-			smallerIndex = rightIndex
-		}
-		indexValue, _ := heap.list.Get(index)
-		smallerValue, _ := heap.list.Get(smallerIndex)
-		if heap.Comparator(indexValue, smallerValue) > 0 {
-			heap.list.Swap(index, smallerIndex)
-		} else {
-			break
-		}
-		index = smallerIndex
-	}
-}
-
-// Performs the "bubble up" operation. This is to place a newly inserted
-// element (i.e. last element in the list) in its correct place so that
-// the heap maintains the min/max-heap order property.
-func (heap *Heap) bubbleUp() {
-	index := heap.list.Size() - 1
-	for parentIndex := (index - 1) >> 1; index > 0; parentIndex = (index - 1) >> 1 {
-		indexValue, _ := heap.list.Get(index)
-		parentValue, _ := heap.list.Get(parentIndex)
-		if heap.Comparator(parentValue, indexValue) <= 0 {
-			break
-		}
-		heap.list.Swap(index, parentIndex)
-		index = parentIndex
-	}
-}
-
-// Check that the index is within bounds of the list
-func (heap *Heap) withinRange(index int) bool {
-	return index >= 0 && index < heap.list.Size()
-}

+ 0 - 84
bashbrew/go/vendor/github.com/emirpasic/gods/trees/binaryheap/iterator.go

@@ -1,84 +0,0 @@
-// Copyright (c) 2015, Emir Pasic. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package binaryheap
-
-import "github.com/emirpasic/gods/containers"
-
-func assertIteratorImplementation() {
-	var _ containers.ReverseIteratorWithIndex = (*Iterator)(nil)
-}
-
-// Iterator returns a stateful iterator whose values can be fetched by an index.
-type Iterator struct {
-	heap  *Heap
-	index int
-}
-
-// Iterator returns a stateful iterator whose values can be fetched by an index.
-func (heap *Heap) Iterator() Iterator {
-	return Iterator{heap: heap, index: -1}
-}
-
-// Next moves the iterator to the next element and returns true if there was a next element in the container.
-// If Next() returns true, then next element's index and value can be retrieved by Index() and Value().
-// If Next() was called for the first time, then it will point the iterator to the first element if it exists.
-// Modifies the state of the iterator.
-func (iterator *Iterator) Next() bool {
-	if iterator.index < iterator.heap.Size() {
-		iterator.index++
-	}
-	return iterator.heap.withinRange(iterator.index)
-}
-
-// Prev moves the iterator to the previous element and returns true if there was a previous element in the container.
-// If Prev() returns true, then previous element's index and value can be retrieved by Index() and Value().
-// Modifies the state of the iterator.
-func (iterator *Iterator) Prev() bool {
-	if iterator.index >= 0 {
-		iterator.index--
-	}
-	return iterator.heap.withinRange(iterator.index)
-}
-
-// Value returns the current element's value.
-// Does not modify the state of the iterator.
-func (iterator *Iterator) Value() interface{} {
-	value, _ := iterator.heap.list.Get(iterator.index)
-	return value
-}
-
-// Index returns the current element's index.
-// Does not modify the state of the iterator.
-func (iterator *Iterator) Index() int {
-	return iterator.index
-}
-
-// Begin resets the iterator to its initial state (one-before-first)
-// Call Next() to fetch the first element if any.
-func (iterator *Iterator) Begin() {
-	iterator.index = -1
-}
-
-// End moves the iterator past the last element (one-past-the-end).
-// Call Prev() to fetch the last element if any.
-func (iterator *Iterator) End() {
-	iterator.index = iterator.heap.Size()
-}
-
-// First moves the iterator to the first element and returns true if there was a first element in the container.
-// If First() returns true, then first element's index and value can be retrieved by Index() and Value().
-// Modifies the state of the iterator.
-func (iterator *Iterator) First() bool {
-	iterator.Begin()
-	return iterator.Next()
-}
-
-// Last moves the iterator to the last element and returns true if there was a last element in the container.
-// If Last() returns true, then last element's index and value can be retrieved by Index() and Value().
-// Modifies the state of the iterator.
-func (iterator *Iterator) Last() bool {
-	iterator.End()
-	return iterator.Prev()
-}

+ 0 - 22
bashbrew/go/vendor/github.com/emirpasic/gods/trees/binaryheap/serialization.go

@@ -1,22 +0,0 @@
-// Copyright (c) 2015, Emir Pasic. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package binaryheap
-
-import "github.com/emirpasic/gods/containers"
-
-func assertSerializationImplementation() {
-	var _ containers.JSONSerializer = (*Heap)(nil)
-	var _ containers.JSONDeserializer = (*Heap)(nil)
-}
-
-// ToJSON outputs the JSON representation of list's elements.
-func (heap *Heap) ToJSON() ([]byte, error) {
-	return heap.list.ToJSON()
-}
-
-// FromJSON populates list's elements from the input JSON representation.
-func (heap *Heap) FromJSON(data []byte) error {
-	return heap.list.FromJSON(data)
-}

+ 0 - 21
bashbrew/go/vendor/github.com/emirpasic/gods/trees/trees.go

@@ -1,21 +0,0 @@
-// Copyright (c) 2015, Emir Pasic. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// Package trees provides an abstract Tree interface.
-//
-// In computer science, a tree is a widely used abstract data type (ADT) or data structure implementing this ADT that simulates a hierarchical tree structure, with a root value and subtrees of children with a parent node, represented as a set of linked nodes.
-//
-// Reference: https://en.wikipedia.org/wiki/Tree_%28data_structure%29
-package trees
-
-import "github.com/emirpasic/gods/containers"
-
-// Tree interface that all trees implement
-type Tree interface {
-	containers.Container
-	// Empty() bool
-	// Size() int
-	// Clear()
-	// Values() []interface{}
-}

+ 0 - 251
bashbrew/go/vendor/github.com/emirpasic/gods/utils/comparator.go

@@ -1,251 +0,0 @@
-// Copyright (c) 2015, Emir Pasic. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package utils
-
-import "time"
-
-// Comparator will make type assertion (see IntComparator for example),
-// which will panic if a or b are not of the asserted type.
-//
-// Should return a number:
-//    negative , if a < b
-//    zero     , if a == b
-//    positive , if a > b
-type Comparator func(a, b interface{}) int
-
-// StringComparator provides a fast comparison on strings
-func StringComparator(a, b interface{}) int {
-	s1 := a.(string)
-	s2 := b.(string)
-	min := len(s2)
-	if len(s1) < len(s2) {
-		min = len(s1)
-	}
-	diff := 0
-	for i := 0; i < min && diff == 0; i++ {
-		diff = int(s1[i]) - int(s2[i])
-	}
-	if diff == 0 {
-		diff = len(s1) - len(s2)
-	}
-	if diff < 0 {
-		return -1
-	}
-	if diff > 0 {
-		return 1
-	}
-	return 0
-}
-
-// IntComparator provides a basic comparison on int
-func IntComparator(a, b interface{}) int {
-	aAsserted := a.(int)
-	bAsserted := b.(int)
-	switch {
-	case aAsserted > bAsserted:
-		return 1
-	case aAsserted < bAsserted:
-		return -1
-	default:
-		return 0
-	}
-}
-
-// Int8Comparator provides a basic comparison on int8
-func Int8Comparator(a, b interface{}) int {
-	aAsserted := a.(int8)
-	bAsserted := b.(int8)
-	switch {
-	case aAsserted > bAsserted:
-		return 1
-	case aAsserted < bAsserted:
-		return -1
-	default:
-		return 0
-	}
-}
-
-// Int16Comparator provides a basic comparison on int16
-func Int16Comparator(a, b interface{}) int {
-	aAsserted := a.(int16)
-	bAsserted := b.(int16)
-	switch {
-	case aAsserted > bAsserted:
-		return 1
-	case aAsserted < bAsserted:
-		return -1
-	default:
-		return 0
-	}
-}
-
-// Int32Comparator provides a basic comparison on int32
-func Int32Comparator(a, b interface{}) int {
-	aAsserted := a.(int32)
-	bAsserted := b.(int32)
-	switch {
-	case aAsserted > bAsserted:
-		return 1
-	case aAsserted < bAsserted:
-		return -1
-	default:
-		return 0
-	}
-}
-
-// Int64Comparator provides a basic comparison on int64
-func Int64Comparator(a, b interface{}) int {
-	aAsserted := a.(int64)
-	bAsserted := b.(int64)
-	switch {
-	case aAsserted > bAsserted:
-		return 1
-	case aAsserted < bAsserted:
-		return -1
-	default:
-		return 0
-	}
-}
-
-// UIntComparator provides a basic comparison on uint
-func UIntComparator(a, b interface{}) int {
-	aAsserted := a.(uint)
-	bAsserted := b.(uint)
-	switch {
-	case aAsserted > bAsserted:
-		return 1
-	case aAsserted < bAsserted:
-		return -1
-	default:
-		return 0
-	}
-}
-
-// UInt8Comparator provides a basic comparison on uint8
-func UInt8Comparator(a, b interface{}) int {
-	aAsserted := a.(uint8)
-	bAsserted := b.(uint8)
-	switch {
-	case aAsserted > bAsserted:
-		return 1
-	case aAsserted < bAsserted:
-		return -1
-	default:
-		return 0
-	}
-}
-
-// UInt16Comparator provides a basic comparison on uint16
-func UInt16Comparator(a, b interface{}) int {
-	aAsserted := a.(uint16)
-	bAsserted := b.(uint16)
-	switch {
-	case aAsserted > bAsserted:
-		return 1
-	case aAsserted < bAsserted:
-		return -1
-	default:
-		return 0
-	}
-}
-
-// UInt32Comparator provides a basic comparison on uint32
-func UInt32Comparator(a, b interface{}) int {
-	aAsserted := a.(uint32)
-	bAsserted := b.(uint32)
-	switch {
-	case aAsserted > bAsserted:
-		return 1
-	case aAsserted < bAsserted:
-		return -1
-	default:
-		return 0
-	}
-}
-
-// UInt64Comparator provides a basic comparison on uint64
-func UInt64Comparator(a, b interface{}) int {
-	aAsserted := a.(uint64)
-	bAsserted := b.(uint64)
-	switch {
-	case aAsserted > bAsserted:
-		return 1
-	case aAsserted < bAsserted:
-		return -1
-	default:
-		return 0
-	}
-}
-
-// Float32Comparator provides a basic comparison on float32
-func Float32Comparator(a, b interface{}) int {
-	aAsserted := a.(float32)
-	bAsserted := b.(float32)
-	switch {
-	case aAsserted > bAsserted:
-		return 1
-	case aAsserted < bAsserted:
-		return -1
-	default:
-		return 0
-	}
-}
-
-// Float64Comparator provides a basic comparison on float64
-func Float64Comparator(a, b interface{}) int {
-	aAsserted := a.(float64)
-	bAsserted := b.(float64)
-	switch {
-	case aAsserted > bAsserted:
-		return 1
-	case aAsserted < bAsserted:
-		return -1
-	default:
-		return 0
-	}
-}
-
-// ByteComparator provides a basic comparison on byte
-func ByteComparator(a, b interface{}) int {
-	aAsserted := a.(byte)
-	bAsserted := b.(byte)
-	switch {
-	case aAsserted > bAsserted:
-		return 1
-	case aAsserted < bAsserted:
-		return -1
-	default:
-		return 0
-	}
-}
-
-// RuneComparator provides a basic comparison on rune
-func RuneComparator(a, b interface{}) int {
-	aAsserted := a.(rune)
-	bAsserted := b.(rune)
-	switch {
-	case aAsserted > bAsserted:
-		return 1
-	case aAsserted < bAsserted:
-		return -1
-	default:
-		return 0
-	}
-}
-
-// TimeComparator provides a basic comparison on time.Time
-func TimeComparator(a, b interface{}) int {
-	aAsserted := a.(time.Time)
-	bAsserted := b.(time.Time)
-
-	switch {
-	case aAsserted.After(bAsserted):
-		return 1
-	case aAsserted.Before(bAsserted):
-		return -1
-	default:
-		return 0
-	}
-}

+ 0 - 29
bashbrew/go/vendor/github.com/emirpasic/gods/utils/sort.go

@@ -1,29 +0,0 @@
-// Copyright (c) 2015, Emir Pasic. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package utils
-
-import "sort"
-
-// Sort sorts values (in-place) with respect to the given comparator.
-//
-// Uses Go's sort (hybrid of quicksort for large and then insertion sort for smaller slices).
-func Sort(values []interface{}, comparator Comparator) {
-	sort.Sort(sortable{values, comparator})
-}
-
-type sortable struct {
-	values     []interface{}
-	comparator Comparator
-}
-
-func (s sortable) Len() int {
-	return len(s.values)
-}
-func (s sortable) Swap(i, j int) {
-	s.values[i], s.values[j] = s.values[j], s.values[i]
-}
-func (s sortable) Less(i, j int) bool {
-	return s.comparator(s.values[i], s.values[j]) < 0
-}

+ 0 - 47
bashbrew/go/vendor/github.com/emirpasic/gods/utils/utils.go

@@ -1,47 +0,0 @@
-// Copyright (c) 2015, Emir Pasic. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// Package utils provides common utility functions.
-//
-// Provided functionalities:
-// - sorting
-// - comparators
-package utils
-
-import (
-	"fmt"
-	"strconv"
-)
-
-// ToString converts a value to string.
-func ToString(value interface{}) string {
-	switch value.(type) {
-	case string:
-		return value.(string)
-	case int8:
-		return strconv.FormatInt(int64(value.(int8)), 10)
-	case int16:
-		return strconv.FormatInt(int64(value.(int16)), 10)
-	case int32:
-		return strconv.FormatInt(int64(value.(int32)), 10)
-	case int64:
-		return strconv.FormatInt(int64(value.(int64)), 10)
-	case uint8:
-		return strconv.FormatUint(uint64(value.(uint8)), 10)
-	case uint16:
-		return strconv.FormatUint(uint64(value.(uint16)), 10)
-	case uint32:
-		return strconv.FormatUint(uint64(value.(uint32)), 10)
-	case uint64:
-		return strconv.FormatUint(uint64(value.(uint64)), 10)
-	case float32:
-		return strconv.FormatFloat(float64(value.(float32)), 'g', -1, 64)
-	case float64:
-		return strconv.FormatFloat(float64(value.(float64)), 'g', -1, 64)
-	case bool:
-		return strconv.FormatBool(value.(bool))
-	default:
-		return fmt.Sprintf("%+v", value)
-	}
-}

+ 0 - 21
bashbrew/go/vendor/github.com/jbenet/go-context/LICENSE

@@ -1,21 +0,0 @@
-The MIT License (MIT)
-
-Copyright (c) 2014 Juan Batiz-Benet
-
-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 - 120
bashbrew/go/vendor/github.com/jbenet/go-context/io/ctxio.go

@@ -1,120 +0,0 @@
-// Package ctxio provides io.Reader and io.Writer wrappers that
-// respect context.Contexts. Use these at the interface between
-// your context code and your io.
-//
-// WARNING: read the code. see how writes and reads will continue
-// until you cancel the io. Maybe this package should provide
-// versions of io.ReadCloser and io.WriteCloser that automatically
-// call .Close when the context expires. But for now -- since in my
-// use cases I have long-lived connections with ephemeral io wrappers
-// -- this has yet to be a need.
-package ctxio
-
-import (
-	"io"
-
-	context "golang.org/x/net/context"
-)
-
-type ioret struct {
-	n   int
-	err error
-}
-
-type Writer interface {
-	io.Writer
-}
-
-type ctxWriter struct {
-	w   io.Writer
-	ctx context.Context
-}
-
-// NewWriter wraps a writer to make it respect given Context.
-// If there is a blocking write, the returned Writer will return
-// whenever the context is cancelled (the return values are n=0
-// and err=ctx.Err().)
-//
-// Note well: this wrapper DOES NOT ACTUALLY cancel the underlying
-// write-- there is no way to do that with the standard go io
-// interface. So the read and write _will_ happen or hang. So, use
-// this sparingly, make sure to cancel the read or write as necesary
-// (e.g. closing a connection whose context is up, etc.)
-//
-// Furthermore, in order to protect your memory from being read
-// _after_ you've cancelled the context, this io.Writer will
-// first make a **copy** of the buffer.
-func NewWriter(ctx context.Context, w io.Writer) *ctxWriter {
-	if ctx == nil {
-		ctx = context.Background()
-	}
-	return &ctxWriter{ctx: ctx, w: w}
-}
-
-func (w *ctxWriter) Write(buf []byte) (int, error) {
-	buf2 := make([]byte, len(buf))
-	copy(buf2, buf)
-
-	c := make(chan ioret, 1)
-
-	go func() {
-		n, err := w.w.Write(buf2)
-		c <- ioret{n, err}
-		close(c)
-	}()
-
-	select {
-	case r := <-c:
-		return r.n, r.err
-	case <-w.ctx.Done():
-		return 0, w.ctx.Err()
-	}
-}
-
-type Reader interface {
-	io.Reader
-}
-
-type ctxReader struct {
-	r   io.Reader
-	ctx context.Context
-}
-
-// NewReader wraps a reader to make it respect given Context.
-// If there is a blocking read, the returned Reader will return
-// whenever the context is cancelled (the return values are n=0
-// and err=ctx.Err().)
-//
-// Note well: this wrapper DOES NOT ACTUALLY cancel the underlying
-// write-- there is no way to do that with the standard go io
-// interface. So the read and write _will_ happen or hang. So, use
-// this sparingly, make sure to cancel the read or write as necesary
-// (e.g. closing a connection whose context is up, etc.)
-//
-// Furthermore, in order to protect your memory from being read
-// _before_ you've cancelled the context, this io.Reader will
-// allocate a buffer of the same size, and **copy** into the client's
-// if the read succeeds in time.
-func NewReader(ctx context.Context, r io.Reader) *ctxReader {
-	return &ctxReader{ctx: ctx, r: r}
-}
-
-func (r *ctxReader) Read(buf []byte) (int, error) {
-	buf2 := make([]byte, len(buf))
-
-	c := make(chan ioret, 1)
-
-	go func() {
-		n, err := r.r.Read(buf2)
-		c <- ioret{n, err}
-		close(c)
-	}()
-
-	select {
-	case ret := <-c:
-		copy(buf, buf2)
-		return ret.n, ret.err
-	case <-r.ctx.Done():
-		return 0, r.ctx.Err()
-	}
-}

+ 0 - 1
bashbrew/go/vendor/github.com/kevinburke/ssh_config/.gitattributes

@@ -1 +0,0 @@
-testdata/dos-lines eol=crlf

+ 0 - 1
bashbrew/go/vendor/github.com/kevinburke/ssh_config/.gitignore

@@ -1 +0,0 @@
-/bazel-*

+ 0 - 15
bashbrew/go/vendor/github.com/kevinburke/ssh_config/.travis.yml

@@ -1,15 +0,0 @@
-go_import_path: github.com/kevinburke/ssh_config
-
-language: go
-
-go:
-  - 1.9.x
-  - 1.10.x
-  - 1.11.x
-  - master
-
-before_script:
-    - go get -u ./...
-
-script:
-    - make race-test

+ 0 - 4
bashbrew/go/vendor/github.com/kevinburke/ssh_config/AUTHORS.txt

@@ -1,4 +0,0 @@
-Eugene Terentev <[email protected]>
-Kevin Burke <[email protected]>
-Sergey Lukjanov <[email protected]>
-Wayne Ashley Berry <[email protected]>

+ 0 - 49
bashbrew/go/vendor/github.com/kevinburke/ssh_config/LICENSE

@@ -1,49 +0,0 @@
-Copyright (c) 2017 Kevin Burke.
-
-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.
-
-===================
-
-The lexer and parser borrow heavily from github.com/pelletier/go-toml. The
-license for that project is copied below.
-
-The MIT License (MIT)
-
-Copyright (c) 2013 - 2017 Thomas Pelletier, Eric Anderton
-
-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 - 32
bashbrew/go/vendor/github.com/kevinburke/ssh_config/Makefile

@@ -1,32 +0,0 @@
-BUMP_VERSION := $(GOPATH)/bin/bump_version
-MEGACHECK := $(GOPATH)/bin/megacheck
-WRITE_MAILMAP := $(GOPATH)/bin/write_mailmap
-
-IGNORES := 'github.com/kevinburke/ssh_config/config.go:U1000 github.com/kevinburke/ssh_config/config.go:S1002 github.com/kevinburke/ssh_config/token.go:U1000'
-
-$(MEGACHECK):
-	go get honnef.co/go/tools/cmd/megacheck
-
-lint: $(MEGACHECK)
-	go vet ./...
-	$(MEGACHECK) --ignore=$(IGNORES) ./...
-
-test: lint
-	@# the timeout helps guard against infinite recursion
-	go test -timeout=250ms ./...
-
-race-test: lint
-	go test -timeout=500ms -race ./...
-
-$(BUMP_VERSION):
-	go get -u github.com/kevinburke/bump_version
-
-release: test | $(BUMP_VERSION)
-	$(BUMP_VERSION) minor config.go
-
-force: ;
-
-AUTHORS.txt: force | $(WRITE_MAILMAP)
-	$(WRITE_MAILMAP) > AUTHORS.txt
-
-authors: AUTHORS.txt

+ 0 - 81
bashbrew/go/vendor/github.com/kevinburke/ssh_config/README.md

@@ -1,81 +0,0 @@
-# ssh_config
-
-This is a Go parser for `ssh_config` files. Importantly, this parser attempts
-to preserve comments in a given file, so you can manipulate a `ssh_config` file
-from a program, if your heart desires.
-
-It's designed to be used with the excellent
-[x/crypto/ssh](https://golang.org/x/crypto/ssh) package, which handles SSH
-negotiation but isn't very easy to configure.
-
-The `ssh_config` `Get()` and `GetStrict()` functions will attempt to read values
-from `$HOME/.ssh/config` and fall back to `/etc/ssh/ssh_config`. The first
-argument is the host name to match on, and the second argument is the key you
-want to retrieve.
-
-```go
-port := ssh_config.Get("myhost", "Port")
-```
-
-You can also load a config file and read values from it.
-
-```go
-var config = `
-Host *.test
-  Compression yes
-`
-
-cfg, err := ssh_config.Decode(strings.NewReader(config))
-fmt.Println(cfg.Get("example.test", "Port"))
-```
-
-Some SSH arguments have default values - for example, the default value for
-`KeyboardAuthentication` is `"yes"`. If you call Get(), and no value for the
-given Host/keyword pair exists in the config, we'll return a default for the
-keyword if one exists.
-
-### Manipulating SSH config files
-
-Here's how you can manipulate an SSH config file, and then write it back to
-disk.
-
-```go
-f, _ := os.Open(filepath.Join(os.Getenv("HOME"), ".ssh", "config"))
-cfg, _ := ssh_config.Decode(f)
-for _, host := range cfg.Hosts {
-    fmt.Println("patterns:", host.Patterns)
-    for _, node := range host.Nodes {
-        // Manipulate the nodes as you see fit, or use a type switch to
-        // distinguish between Empty, KV, and Include nodes.
-        fmt.Println(node.String())
-    }
-}
-
-// Print the config to stdout:
-fmt.Println(cfg.String())
-```
-
-## Spec compliance
-
-Wherever possible we try to implement the specification as documented in
-the `ssh_config` manpage. Unimplemented features should be present in the
-[issues][issues] list.
-
-Notably, the `Match` directive is currently unsupported.
-
-[issues]: https://github.com/kevinburke/ssh_config/issues
-
-## Errata
-
-This is the second [comment-preserving configuration parser][blog] I've written, after
-[an /etc/hosts parser][hostsfile]. Eventually, I will write one for every Linux
-file format.
-
-[blog]: https://kev.inburke.com/kevin/more-comment-preserving-configuration-parsers/
-[hostsfile]: https://github.com/kevinburke/hostsfile
-
-## Donating
-
-Donations free up time to make improvements to the library, and respond to
-bug reports. You can send donations via Paypal's "Send Money" feature to
[email protected]. Donations are not tax deductible in the USA.

+ 0 - 639
bashbrew/go/vendor/github.com/kevinburke/ssh_config/config.go

@@ -1,639 +0,0 @@
-// Package ssh_config provides tools for manipulating SSH config files.
-//
-// Importantly, this parser attempts to preserve comments in a given file, so
-// you can manipulate a `ssh_config` file from a program, if your heart desires.
-//
-// The Get() and GetStrict() functions will attempt to read values from
-// $HOME/.ssh/config, falling back to /etc/ssh/ssh_config. The first argument is
-// the host name to match on ("example.com"), and the second argument is the key
-// you want to retrieve ("Port"). The keywords are case insensitive.
-//
-// 		port := ssh_config.Get("myhost", "Port")
-//
-// You can also manipulate an SSH config file and then print it or write it back
-// to disk.
-//
-//	f, _ := os.Open(filepath.Join(os.Getenv("HOME"), ".ssh", "config"))
-//	cfg, _ := ssh_config.Decode(f)
-//	for _, host := range cfg.Hosts {
-//		fmt.Println("patterns:", host.Patterns)
-//		for _, node := range host.Nodes {
-//			fmt.Println(node.String())
-//		}
-//	}
-//
-//	// Write the cfg back to disk:
-//	fmt.Println(cfg.String())
-//
-// BUG: the Match directive is currently unsupported; parsing a config with
-// a Match directive will trigger an error.
-package ssh_config
-
-import (
-	"bytes"
-	"errors"
-	"fmt"
-	"io"
-	"os"
-	osuser "os/user"
-	"path/filepath"
-	"regexp"
-	"runtime"
-	"strings"
-	"sync"
-)
-
-const version = "0.5"
-
-type configFinder func() string
-
-// UserSettings checks ~/.ssh and /etc/ssh for configuration files. The config
-// files are parsed and cached the first time Get() or GetStrict() is called.
-type UserSettings struct {
-	IgnoreErrors       bool
-	systemConfig       *Config
-	systemConfigFinder configFinder
-	userConfig         *Config
-	userConfigFinder   configFinder
-	loadConfigs        sync.Once
-	onceErr            error
-}
-
-func homedir() string {
-	user, err := osuser.Current()
-	if err == nil {
-		return user.HomeDir
-	} else {
-		return os.Getenv("HOME")
-	}
-}
-
-func userConfigFinder() string {
-	return filepath.Join(homedir(), ".ssh", "config")
-}
-
-// DefaultUserSettings is the default UserSettings and is used by Get and
-// GetStrict. It checks both $HOME/.ssh/config and /etc/ssh/ssh_config for keys,
-// and it will return parse errors (if any) instead of swallowing them.
-var DefaultUserSettings = &UserSettings{
-	IgnoreErrors:       false,
-	systemConfigFinder: systemConfigFinder,
-	userConfigFinder:   userConfigFinder,
-}
-
-func systemConfigFinder() string {
-	return filepath.Join("/", "etc", "ssh", "ssh_config")
-}
-
-func findVal(c *Config, alias, key string) (string, error) {
-	if c == nil {
-		return "", nil
-	}
-	val, err := c.Get(alias, key)
-	if err != nil || val == "" {
-		return "", err
-	}
-	if err := validate(key, val); err != nil {
-		return "", err
-	}
-	return val, nil
-}
-
-// Get finds the first value for key within a declaration that matches the
-// alias. Get returns the empty string if no value was found, or if IgnoreErrors
-// is false and we could not parse the configuration file. Use GetStrict to
-// disambiguate the latter cases.
-//
-// The match for key is case insensitive.
-//
-// Get is a wrapper around DefaultUserSettings.Get.
-func Get(alias, key string) string {
-	return DefaultUserSettings.Get(alias, key)
-}
-
-// GetStrict finds the first value for key within a declaration that matches the
-// alias. If key has a default value and no matching configuration is found, the
-// default will be returned. For more information on default values and the way
-// patterns are matched, see the manpage for ssh_config.
-//
-// error will be non-nil if and only if a user's configuration file or the
-// system configuration file could not be parsed, and u.IgnoreErrors is false.
-//
-// GetStrict is a wrapper around DefaultUserSettings.GetStrict.
-func GetStrict(alias, key string) (string, error) {
-	return DefaultUserSettings.GetStrict(alias, key)
-}
-
-// Get finds the first value for key within a declaration that matches the
-// alias. Get returns the empty string if no value was found, or if IgnoreErrors
-// is false and we could not parse the configuration file. Use GetStrict to
-// disambiguate the latter cases.
-//
-// The match for key is case insensitive.
-func (u *UserSettings) Get(alias, key string) string {
-	val, err := u.GetStrict(alias, key)
-	if err != nil {
-		return ""
-	}
-	return val
-}
-
-// GetStrict finds the first value for key within a declaration that matches the
-// alias. If key has a default value and no matching configuration is found, the
-// default will be returned. For more information on default values and the way
-// patterns are matched, see the manpage for ssh_config.
-//
-// error will be non-nil if and only if a user's configuration file or the
-// system configuration file could not be parsed, and u.IgnoreErrors is false.
-func (u *UserSettings) GetStrict(alias, key string) (string, error) {
-	u.loadConfigs.Do(func() {
-		// can't parse user file, that's ok.
-		var filename string
-		if u.userConfigFinder == nil {
-			filename = userConfigFinder()
-		} else {
-			filename = u.userConfigFinder()
-		}
-		var err error
-		u.userConfig, err = parseFile(filename)
-		if err != nil && os.IsNotExist(err) == false {
-			u.onceErr = err
-			return
-		}
-		if u.systemConfigFinder == nil {
-			filename = systemConfigFinder()
-		} else {
-			filename = u.systemConfigFinder()
-		}
-		u.systemConfig, err = parseFile(filename)
-		if err != nil && os.IsNotExist(err) == false {
-			u.onceErr = err
-			return
-		}
-	})
-	if u.onceErr != nil && u.IgnoreErrors == false {
-		return "", u.onceErr
-	}
-	val, err := findVal(u.userConfig, alias, key)
-	if err != nil || val != "" {
-		return val, err
-	}
-	val2, err2 := findVal(u.systemConfig, alias, key)
-	if err2 != nil || val2 != "" {
-		return val2, err2
-	}
-	return Default(key), nil
-}
-
-func parseFile(filename string) (*Config, error) {
-	return parseWithDepth(filename, 0)
-}
-
-func parseWithDepth(filename string, depth uint8) (*Config, error) {
-	f, err := os.Open(filename)
-	if err != nil {
-		return nil, err
-	}
-	defer f.Close()
-	return decode(f, isSystem(filename), depth)
-}
-
-func isSystem(filename string) bool {
-	// TODO i'm not sure this is the best way to detect a system repo
-	return strings.HasPrefix(filepath.Clean(filename), "/etc/ssh")
-}
-
-// Decode reads r into a Config, or returns an error if r could not be parsed as
-// an SSH config file.
-func Decode(r io.Reader) (*Config, error) {
-	return decode(r, false, 0)
-}
-
-func decode(r io.Reader, system bool, depth uint8) (c *Config, err error) {
-	defer func() {
-		if r := recover(); r != nil {
-			if _, ok := r.(runtime.Error); ok {
-				panic(r)
-			}
-			if e, ok := r.(error); ok && e == ErrDepthExceeded {
-				err = e
-				return
-			}
-			err = errors.New(r.(string))
-		}
-	}()
-
-	c = parseSSH(lexSSH(r), system, depth)
-	return c, err
-}
-
-// Config represents an SSH config file.
-type Config struct {
-	// A list of hosts to match against. The file begins with an implicit
-	// "Host *" declaration matching all hosts.
-	Hosts    []*Host
-	depth    uint8
-	position Position
-}
-
-// Get finds the first value in the configuration that matches the alias and
-// contains key. Get returns the empty string if no value was found, or if the
-// Config contains an invalid conditional Include value.
-//
-// The match for key is case insensitive.
-func (c *Config) Get(alias, key string) (string, error) {
-	lowerKey := strings.ToLower(key)
-	for _, host := range c.Hosts {
-		if !host.Matches(alias) {
-			continue
-		}
-		for _, node := range host.Nodes {
-			switch t := node.(type) {
-			case *Empty:
-				continue
-			case *KV:
-				// "keys are case insensitive" per the spec
-				lkey := strings.ToLower(t.Key)
-				if lkey == "match" {
-					panic("can't handle Match directives")
-				}
-				if lkey == lowerKey {
-					return t.Value, nil
-				}
-			case *Include:
-				val := t.Get(alias, key)
-				if val != "" {
-					return val, nil
-				}
-			default:
-				return "", fmt.Errorf("unknown Node type %v", t)
-			}
-		}
-	}
-	return "", nil
-}
-
-// String returns a string representation of the Config file.
-func (c Config) String() string {
-	return marshal(c).String()
-}
-
-func (c Config) MarshalText() ([]byte, error) {
-	return marshal(c).Bytes(), nil
-}
-
-func marshal(c Config) *bytes.Buffer {
-	var buf bytes.Buffer
-	for i := range c.Hosts {
-		buf.WriteString(c.Hosts[i].String())
-	}
-	return &buf
-}
-
-// Pattern is a pattern in a Host declaration. Patterns are read-only values;
-// create a new one with NewPattern().
-type Pattern struct {
-	str   string // Its appearance in the file, not the value that gets compiled.
-	regex *regexp.Regexp
-	not   bool // True if this is a negated match
-}
-
-// String prints the string representation of the pattern.
-func (p Pattern) String() string {
-	return p.str
-}
-
-// Copied from regexp.go with * and ? removed.
-var specialBytes = []byte(`\.+()|[]{}^$`)
-
-func special(b byte) bool {
-	return bytes.IndexByte(specialBytes, b) >= 0
-}
-
-// NewPattern creates a new Pattern for matching hosts. NewPattern("*") creates
-// a Pattern that matches all hosts.
-//
-// From the manpage, a pattern consists of zero or more non-whitespace
-// characters, `*' (a wildcard that matches zero or more characters), or `?' (a
-// wildcard that matches exactly one character). For example, to specify a set
-// of declarations for any host in the ".co.uk" set of domains, the following
-// pattern could be used:
-//
-//	Host *.co.uk
-//
-// The following pattern would match any host in the 192.168.0.[0-9] network range:
-//
-//	Host 192.168.0.?
-func NewPattern(s string) (*Pattern, error) {
-	if s == "" {
-		return nil, errors.New("ssh_config: empty pattern")
-	}
-	negated := false
-	if s[0] == '!' {
-		negated = true
-		s = s[1:]
-	}
-	var buf bytes.Buffer
-	buf.WriteByte('^')
-	for i := 0; i < len(s); i++ {
-		// A byte loop is correct because all metacharacters are ASCII.
-		switch b := s[i]; b {
-		case '*':
-			buf.WriteString(".*")
-		case '?':
-			buf.WriteString(".?")
-		default:
-			// borrowing from QuoteMeta here.
-			if special(b) {
-				buf.WriteByte('\\')
-			}
-			buf.WriteByte(b)
-		}
-	}
-	buf.WriteByte('$')
-	r, err := regexp.Compile(buf.String())
-	if err != nil {
-		return nil, err
-	}
-	return &Pattern{str: s, regex: r, not: negated}, nil
-}
-
-// Host describes a Host directive and the keywords that follow it.
-type Host struct {
-	// A list of host patterns that should match this host.
-	Patterns []*Pattern
-	// A Node is either a key/value pair or a comment line.
-	Nodes []Node
-	// EOLComment is the comment (if any) terminating the Host line.
-	EOLComment   string
-	hasEquals    bool
-	leadingSpace uint16 // TODO: handle spaces vs tabs here.
-	// The file starts with an implicit "Host *" declaration.
-	implicit bool
-}
-
-// Matches returns true if the Host matches for the given alias. For
-// a description of the rules that provide a match, see the manpage for
-// ssh_config.
-func (h *Host) Matches(alias string) bool {
-	found := false
-	for i := range h.Patterns {
-		if h.Patterns[i].regex.MatchString(alias) {
-			if h.Patterns[i].not == true {
-				// Negated match. "A pattern entry may be negated by prefixing
-				// it with an exclamation mark (`!'). If a negated entry is
-				// matched, then the Host entry is ignored, regardless of
-				// whether any other patterns on the line match. Negated matches
-				// are therefore useful to provide exceptions for wildcard
-				// matches."
-				return false
-			}
-			found = true
-		}
-	}
-	return found
-}
-
-// String prints h as it would appear in a config file. Minor tweaks may be
-// present in the whitespace in the printed file.
-func (h *Host) String() string {
-	var buf bytes.Buffer
-	if h.implicit == false {
-		buf.WriteString(strings.Repeat(" ", int(h.leadingSpace)))
-		buf.WriteString("Host")
-		if h.hasEquals {
-			buf.WriteString(" = ")
-		} else {
-			buf.WriteString(" ")
-		}
-		for i, pat := range h.Patterns {
-			buf.WriteString(pat.String())
-			if i < len(h.Patterns)-1 {
-				buf.WriteString(" ")
-			}
-		}
-		if h.EOLComment != "" {
-			buf.WriteString(" #")
-			buf.WriteString(h.EOLComment)
-		}
-		buf.WriteByte('\n')
-	}
-	for i := range h.Nodes {
-		buf.WriteString(h.Nodes[i].String())
-		buf.WriteByte('\n')
-	}
-	return buf.String()
-}
-
-// Node represents a line in a Config.
-type Node interface {
-	Pos() Position
-	String() string
-}
-
-// KV is a line in the config file that contains a key, a value, and possibly
-// a comment.
-type KV struct {
-	Key          string
-	Value        string
-	Comment      string
-	hasEquals    bool
-	leadingSpace uint16 // Space before the key. TODO handle spaces vs tabs.
-	position     Position
-}
-
-// Pos returns k's Position.
-func (k *KV) Pos() Position {
-	return k.position
-}
-
-// String prints k as it was parsed in the config file. There may be slight
-// changes to the whitespace between values.
-func (k *KV) String() string {
-	if k == nil {
-		return ""
-	}
-	equals := " "
-	if k.hasEquals {
-		equals = " = "
-	}
-	line := fmt.Sprintf("%s%s%s%s", strings.Repeat(" ", int(k.leadingSpace)), k.Key, equals, k.Value)
-	if k.Comment != "" {
-		line += " #" + k.Comment
-	}
-	return line
-}
-
-// Empty is a line in the config file that contains only whitespace or comments.
-type Empty struct {
-	Comment      string
-	leadingSpace uint16 // TODO handle spaces vs tabs.
-	position     Position
-}
-
-// Pos returns e's Position.
-func (e *Empty) Pos() Position {
-	return e.position
-}
-
-// String prints e as it was parsed in the config file.
-func (e *Empty) String() string {
-	if e == nil {
-		return ""
-	}
-	if e.Comment == "" {
-		return ""
-	}
-	return fmt.Sprintf("%s#%s", strings.Repeat(" ", int(e.leadingSpace)), e.Comment)
-}
-
-// Include holds the result of an Include directive, including the config files
-// that have been parsed as part of that directive. At most 5 levels of Include
-// statements will be parsed.
-type Include struct {
-	// Comment is the contents of any comment at the end of the Include
-	// statement.
-	Comment string
-	parsed  bool
-	// an include directive can include several different files, and wildcards
-	directives []string
-
-	mu sync.Mutex
-	// 1:1 mapping between matches and keys in files array; matches preserves
-	// ordering
-	matches []string
-	// actual filenames are listed here
-	files        map[string]*Config
-	leadingSpace uint16
-	position     Position
-	depth        uint8
-	hasEquals    bool
-}
-
-const maxRecurseDepth = 5
-
-// ErrDepthExceeded is returned if too many Include directives are parsed.
-// Usually this indicates a recursive loop (an Include directive pointing to the
-// file it contains).
-var ErrDepthExceeded = errors.New("ssh_config: max recurse depth exceeded")
-
-func removeDups(arr []string) []string {
-	// Use map to record duplicates as we find them.
-	encountered := make(map[string]bool, len(arr))
-	result := make([]string, 0)
-
-	for v := range arr {
-		if encountered[arr[v]] == false {
-			encountered[arr[v]] = true
-			result = append(result, arr[v])
-		}
-	}
-	return result
-}
-
-// NewInclude creates a new Include with a list of file globs to include.
-// Configuration files are parsed greedily (e.g. as soon as this function runs).
-// Any error encountered while parsing nested configuration files will be
-// returned.
-func NewInclude(directives []string, hasEquals bool, pos Position, comment string, system bool, depth uint8) (*Include, error) {
-	if depth > maxRecurseDepth {
-		return nil, ErrDepthExceeded
-	}
-	inc := &Include{
-		Comment:      comment,
-		directives:   directives,
-		files:        make(map[string]*Config),
-		position:     pos,
-		leadingSpace: uint16(pos.Col) - 1,
-		depth:        depth,
-		hasEquals:    hasEquals,
-	}
-	// no need for inc.mu.Lock() since nothing else can access this inc
-	matches := make([]string, 0)
-	for i := range directives {
-		var path string
-		if filepath.IsAbs(directives[i]) {
-			path = directives[i]
-		} else if system {
-			path = filepath.Join("/etc/ssh", directives[i])
-		} else {
-			path = filepath.Join(homedir(), ".ssh", directives[i])
-		}
-		theseMatches, err := filepath.Glob(path)
-		if err != nil {
-			return nil, err
-		}
-		matches = append(matches, theseMatches...)
-	}
-	matches = removeDups(matches)
-	inc.matches = matches
-	for i := range matches {
-		config, err := parseWithDepth(matches[i], depth)
-		if err != nil {
-			return nil, err
-		}
-		inc.files[matches[i]] = config
-	}
-	return inc, nil
-}
-
-// Pos returns the position of the Include directive in the larger file.
-func (i *Include) Pos() Position {
-	return i.position
-}
-
-// Get finds the first value in the Include statement matching the alias and the
-// given key.
-func (inc *Include) Get(alias, key string) string {
-	inc.mu.Lock()
-	defer inc.mu.Unlock()
-	// TODO: we search files in any order which is not correct
-	for i := range inc.matches {
-		cfg := inc.files[inc.matches[i]]
-		if cfg == nil {
-			panic("nil cfg")
-		}
-		val, err := cfg.Get(alias, key)
-		if err == nil && val != "" {
-			return val
-		}
-	}
-	return ""
-}
-
-// String prints out a string representation of this Include directive. Note
-// included Config files are not printed as part of this representation.
-func (inc *Include) String() string {
-	equals := " "
-	if inc.hasEquals {
-		equals = " = "
-	}
-	line := fmt.Sprintf("%sInclude%s%s", strings.Repeat(" ", int(inc.leadingSpace)), equals, strings.Join(inc.directives, " "))
-	if inc.Comment != "" {
-		line += " #" + inc.Comment
-	}
-	return line
-}
-
-var matchAll *Pattern
-
-func init() {
-	var err error
-	matchAll, err = NewPattern("*")
-	if err != nil {
-		panic(err)
-	}
-}
-
-func newConfig() *Config {
-	return &Config{
-		Hosts: []*Host{
-			&Host{
-				implicit: true,
-				Patterns: []*Pattern{matchAll},
-				Nodes:    make([]Node, 0),
-			},
-		},
-		depth: 0,
-	}
-}

+ 0 - 241
bashbrew/go/vendor/github.com/kevinburke/ssh_config/lexer.go

@@ -1,241 +0,0 @@
-package ssh_config
-
-import (
-	"io"
-
-	buffruneio "github.com/pelletier/go-buffruneio"
-)
-
-// Define state functions
-type sshLexStateFn func() sshLexStateFn
-
-type sshLexer struct {
-	input         *buffruneio.Reader // Textual source
-	buffer        []rune             // Runes composing the current token
-	tokens        chan token
-	line          uint32
-	col           uint16
-	endbufferLine uint32
-	endbufferCol  uint16
-}
-
-func (s *sshLexer) lexComment(previousState sshLexStateFn) sshLexStateFn {
-	return func() sshLexStateFn {
-		growingString := ""
-		for next := s.peek(); next != '\n' && next != eof; next = s.peek() {
-			if next == '\r' && s.follow("\r\n") {
-				break
-			}
-			growingString += string(next)
-			s.next()
-		}
-		s.emitWithValue(tokenComment, growingString)
-		s.skip()
-		return previousState
-	}
-}
-
-// lex the space after an equals sign in a function
-func (s *sshLexer) lexRspace() sshLexStateFn {
-	for {
-		next := s.peek()
-		if !isSpace(next) {
-			break
-		}
-		s.skip()
-	}
-	return s.lexRvalue
-}
-
-func (s *sshLexer) lexEquals() sshLexStateFn {
-	for {
-		next := s.peek()
-		if next == '=' {
-			s.emit(tokenEquals)
-			s.skip()
-			return s.lexRspace
-		}
-		// TODO error handling here; newline eof etc.
-		if !isSpace(next) {
-			break
-		}
-		s.skip()
-	}
-	return s.lexRvalue
-}
-
-func (s *sshLexer) lexKey() sshLexStateFn {
-	growingString := ""
-
-	for r := s.peek(); isKeyChar(r); r = s.peek() {
-		// simplified a lot here
-		if isSpace(r) || r == '=' {
-			s.emitWithValue(tokenKey, growingString)
-			s.skip()
-			return s.lexEquals
-		}
-		growingString += string(r)
-		s.next()
-	}
-	s.emitWithValue(tokenKey, growingString)
-	return s.lexEquals
-}
-
-func (s *sshLexer) lexRvalue() sshLexStateFn {
-	growingString := ""
-	for {
-		next := s.peek()
-		switch next {
-		case '\r':
-			if s.follow("\r\n") {
-				s.emitWithValue(tokenString, growingString)
-				s.skip()
-				return s.lexVoid
-			}
-		case '\n':
-			s.emitWithValue(tokenString, growingString)
-			s.skip()
-			return s.lexVoid
-		case '#':
-			s.emitWithValue(tokenString, growingString)
-			s.skip()
-			return s.lexComment(s.lexVoid)
-		case eof:
-			s.next()
-		}
-		if next == eof {
-			break
-		}
-		growingString += string(next)
-		s.next()
-	}
-	s.emit(tokenEOF)
-	return nil
-}
-
-func (s *sshLexer) read() rune {
-	r, _, err := s.input.ReadRune()
-	if err != nil {
-		panic(err)
-	}
-	if r == '\n' {
-		s.endbufferLine++
-		s.endbufferCol = 1
-	} else {
-		s.endbufferCol++
-	}
-	return r
-}
-
-func (s *sshLexer) next() rune {
-	r := s.read()
-
-	if r != eof {
-		s.buffer = append(s.buffer, r)
-	}
-	return r
-}
-
-func (s *sshLexer) lexVoid() sshLexStateFn {
-	for {
-		next := s.peek()
-		switch next {
-		case '#':
-			s.skip()
-			return s.lexComment(s.lexVoid)
-		case '\r':
-			fallthrough
-		case '\n':
-			s.emit(tokenEmptyLine)
-			s.skip()
-			continue
-		}
-
-		if isSpace(next) {
-			s.skip()
-		}
-
-		if isKeyStartChar(next) {
-			return s.lexKey
-		}
-
-		// removed IsKeyStartChar and lexKey. probably will need to readd
-
-		if next == eof {
-			s.next()
-			break
-		}
-	}
-
-	s.emit(tokenEOF)
-	return nil
-}
-
-func (s *sshLexer) ignore() {
-	s.buffer = make([]rune, 0)
-	s.line = s.endbufferLine
-	s.col = s.endbufferCol
-}
-
-func (s *sshLexer) skip() {
-	s.next()
-	s.ignore()
-}
-
-func (s *sshLexer) emit(t tokenType) {
-	s.emitWithValue(t, string(s.buffer))
-}
-
-func (s *sshLexer) emitWithValue(t tokenType, value string) {
-	tok := token{
-		Position: Position{s.line, s.col},
-		typ:      t,
-		val:      value,
-	}
-	s.tokens <- tok
-	s.ignore()
-}
-
-func (s *sshLexer) peek() rune {
-	r, _, err := s.input.ReadRune()
-	if err != nil {
-		panic(err)
-	}
-	s.input.UnreadRune()
-	return r
-}
-
-func (s *sshLexer) follow(next string) bool {
-	for _, expectedRune := range next {
-		r, _, err := s.input.ReadRune()
-		defer s.input.UnreadRune()
-		if err != nil {
-			panic(err)
-		}
-		if expectedRune != r {
-			return false
-		}
-	}
-	return true
-}
-
-func (s *sshLexer) run() {
-	for state := s.lexVoid; state != nil; {
-		state = state()
-	}
-	close(s.tokens)
-}
-
-func lexSSH(input io.Reader) chan token {
-	bufferedInput := buffruneio.NewReader(input)
-	l := &sshLexer{
-		input:         bufferedInput,
-		tokens:        make(chan token),
-		line:          1,
-		col:           1,
-		endbufferLine: 1,
-		endbufferCol:  1,
-	}
-	go l.run()
-	return l.tokens
-}

+ 0 - 185
bashbrew/go/vendor/github.com/kevinburke/ssh_config/parser.go

@@ -1,185 +0,0 @@
-package ssh_config
-
-import (
-	"fmt"
-	"strings"
-)
-
-type sshParser struct {
-	flow          chan token
-	config        *Config
-	tokensBuffer  []token
-	currentTable  []string
-	seenTableKeys []string
-	// /etc/ssh parser or local parser - used to find the default for relative
-	// filepaths in the Include directive
-	system bool
-	depth  uint8
-}
-
-type sshParserStateFn func() sshParserStateFn
-
-// Formats and panics an error message based on a token
-func (p *sshParser) raiseErrorf(tok *token, msg string, args ...interface{}) {
-	// TODO this format is ugly
-	panic(tok.Position.String() + ": " + fmt.Sprintf(msg, args...))
-}
-
-func (p *sshParser) raiseError(tok *token, err error) {
-	if err == ErrDepthExceeded {
-		panic(err)
-	}
-	// TODO this format is ugly
-	panic(tok.Position.String() + ": " + err.Error())
-}
-
-func (p *sshParser) run() {
-	for state := p.parseStart; state != nil; {
-		state = state()
-	}
-}
-
-func (p *sshParser) peek() *token {
-	if len(p.tokensBuffer) != 0 {
-		return &(p.tokensBuffer[0])
-	}
-
-	tok, ok := <-p.flow
-	if !ok {
-		return nil
-	}
-	p.tokensBuffer = append(p.tokensBuffer, tok)
-	return &tok
-}
-
-func (p *sshParser) getToken() *token {
-	if len(p.tokensBuffer) != 0 {
-		tok := p.tokensBuffer[0]
-		p.tokensBuffer = p.tokensBuffer[1:]
-		return &tok
-	}
-	tok, ok := <-p.flow
-	if !ok {
-		return nil
-	}
-	return &tok
-}
-
-func (p *sshParser) parseStart() sshParserStateFn {
-	tok := p.peek()
-
-	// end of stream, parsing is finished
-	if tok == nil {
-		return nil
-	}
-
-	switch tok.typ {
-	case tokenComment, tokenEmptyLine:
-		return p.parseComment
-	case tokenKey:
-		return p.parseKV
-	case tokenEOF:
-		return nil
-	default:
-		p.raiseErrorf(tok, fmt.Sprintf("unexpected token %q\n", tok))
-	}
-	return nil
-}
-
-func (p *sshParser) parseKV() sshParserStateFn {
-	key := p.getToken()
-	hasEquals := false
-	val := p.getToken()
-	if val.typ == tokenEquals {
-		hasEquals = true
-		val = p.getToken()
-	}
-	comment := ""
-	tok := p.peek()
-	if tok == nil {
-		tok = &token{typ: tokenEOF}
-	}
-	if tok.typ == tokenComment && tok.Position.Line == val.Position.Line {
-		tok = p.getToken()
-		comment = tok.val
-	}
-	if strings.ToLower(key.val) == "match" {
-		// https://github.com/kevinburke/ssh_config/issues/6
-		p.raiseErrorf(val, "ssh_config: Match directive parsing is unsupported")
-		return nil
-	}
-	if strings.ToLower(key.val) == "host" {
-		strPatterns := strings.Split(val.val, " ")
-		patterns := make([]*Pattern, 0)
-		for i := range strPatterns {
-			if strPatterns[i] == "" {
-				continue
-			}
-			pat, err := NewPattern(strPatterns[i])
-			if err != nil {
-				p.raiseErrorf(val, "Invalid host pattern: %v", err)
-				return nil
-			}
-			patterns = append(patterns, pat)
-		}
-		p.config.Hosts = append(p.config.Hosts, &Host{
-			Patterns:   patterns,
-			Nodes:      make([]Node, 0),
-			EOLComment: comment,
-			hasEquals:  hasEquals,
-		})
-		return p.parseStart
-	}
-	lastHost := p.config.Hosts[len(p.config.Hosts)-1]
-	if strings.ToLower(key.val) == "include" {
-		inc, err := NewInclude(strings.Split(val.val, " "), hasEquals, key.Position, comment, p.system, p.depth+1)
-		if err == ErrDepthExceeded {
-			p.raiseError(val, err)
-			return nil
-		}
-		if err != nil {
-			p.raiseErrorf(val, "Error parsing Include directive: %v", err)
-			return nil
-		}
-		lastHost.Nodes = append(lastHost.Nodes, inc)
-		return p.parseStart
-	}
-	kv := &KV{
-		Key:          key.val,
-		Value:        val.val,
-		Comment:      comment,
-		hasEquals:    hasEquals,
-		leadingSpace: uint16(key.Position.Col) - 1,
-		position:     key.Position,
-	}
-	lastHost.Nodes = append(lastHost.Nodes, kv)
-	return p.parseStart
-}
-
-func (p *sshParser) parseComment() sshParserStateFn {
-	comment := p.getToken()
-	lastHost := p.config.Hosts[len(p.config.Hosts)-1]
-	lastHost.Nodes = append(lastHost.Nodes, &Empty{
-		Comment: comment.val,
-		// account for the "#" as well
-		leadingSpace: comment.Position.Col - 2,
-		position:     comment.Position,
-	})
-	return p.parseStart
-}
-
-func parseSSH(flow chan token, system bool, depth uint8) *Config {
-	result := newConfig()
-	result.position = Position{1, 1}
-	parser := &sshParser{
-		flow:          flow,
-		config:        result,
-		tokensBuffer:  make([]token, 0),
-		currentTable:  make([]string, 0),
-		seenTableKeys: make([]string, 0),
-		system:        system,
-		depth:         depth,
-	}
-	parser.run()
-	return result
-}

+ 0 - 25
bashbrew/go/vendor/github.com/kevinburke/ssh_config/position.go

@@ -1,25 +0,0 @@
-package ssh_config
-
-import "fmt"
-
-// Position of a document element within a SSH document.
-//
-// Line and Col are both 1-indexed positions for the element's line number and
-// column number, respectively.  Values of zero or less will cause Invalid(),
-// to return true.
-type Position struct {
-	Line uint32 // line within the document
-	Col  uint16 // column within the line
-}
-
-// String representation of the position.
-// Displays 1-indexed line and column numbers.
-func (p Position) String() string {
-	return fmt.Sprintf("(%d, %d)", p.Line, p.Col)
-}
-
-// Invalid returns whether or not the position is valid (i.e. with negative or
-// null values)
-func (p Position) Invalid() bool {
-	return p.Line <= 0 || p.Col <= 0
-}

+ 0 - 49
bashbrew/go/vendor/github.com/kevinburke/ssh_config/token.go

@@ -1,49 +0,0 @@
-package ssh_config
-
-import "fmt"
-
-type token struct {
-	Position
-	typ tokenType
-	val string
-}
-
-func (t token) String() string {
-	switch t.typ {
-	case tokenEOF:
-		return "EOF"
-	}
-	return fmt.Sprintf("%q", t.val)
-}
-
-type tokenType int
-
-const (
-	eof = -(iota + 1)
-)
-
-const (
-	tokenError tokenType = iota
-	tokenEOF
-	tokenEmptyLine
-	tokenComment
-	tokenKey
-	tokenEquals
-	tokenString
-)
-
-func isSpace(r rune) bool {
-	return r == ' ' || r == '\t'
-}
-
-func isKeyStartChar(r rune) bool {
-	return !(isSpace(r) || r == '\r' || r == '\n' || r == eof)
-}
-
-// I'm not sure that this is correct
-func isKeyChar(r rune) bool {
-	// Keys start with the first character that isn't whitespace or [ and end
-	// with the last non-whitespace character before the equals sign. Keys
-	// cannot contain a # character."
-	return !(r == '\r' || r == '\n' || r == eof || r == '=')
-}

+ 0 - 162
bashbrew/go/vendor/github.com/kevinburke/ssh_config/validators.go

@@ -1,162 +0,0 @@
-package ssh_config
-
-import (
-	"fmt"
-	"strconv"
-	"strings"
-)
-
-// Default returns the default value for the given keyword, for example "22" if
-// the keyword is "Port". Default returns the empty string if the keyword has no
-// default, or if the keyword is unknown. Keyword matching is case-insensitive.
-//
-// Default values are provided by OpenSSH_7.4p1 on a Mac.
-func Default(keyword string) string {
-	return defaults[strings.ToLower(keyword)]
-}
-
-// Arguments where the value must be "yes" or "no" and *only* yes or no.
-var yesnos = map[string]bool{
-	strings.ToLower("BatchMode"):                        true,
-	strings.ToLower("CanonicalizeFallbackLocal"):        true,
-	strings.ToLower("ChallengeResponseAuthentication"):  true,
-	strings.ToLower("CheckHostIP"):                      true,
-	strings.ToLower("ClearAllForwardings"):              true,
-	strings.ToLower("Compression"):                      true,
-	strings.ToLower("EnableSSHKeysign"):                 true,
-	strings.ToLower("ExitOnForwardFailure"):             true,
-	strings.ToLower("ForwardAgent"):                     true,
-	strings.ToLower("ForwardX11"):                       true,
-	strings.ToLower("ForwardX11Trusted"):                true,
-	strings.ToLower("GatewayPorts"):                     true,
-	strings.ToLower("GSSAPIAuthentication"):             true,
-	strings.ToLower("GSSAPIDelegateCredentials"):        true,
-	strings.ToLower("HostbasedAuthentication"):          true,
-	strings.ToLower("IdentitiesOnly"):                   true,
-	strings.ToLower("KbdInteractiveAuthentication"):     true,
-	strings.ToLower("NoHostAuthenticationForLocalhost"): true,
-	strings.ToLower("PasswordAuthentication"):           true,
-	strings.ToLower("PermitLocalCommand"):               true,
-	strings.ToLower("PubkeyAuthentication"):             true,
-	strings.ToLower("RhostsRSAAuthentication"):          true,
-	strings.ToLower("RSAAuthentication"):                true,
-	strings.ToLower("StreamLocalBindUnlink"):            true,
-	strings.ToLower("TCPKeepAlive"):                     true,
-	strings.ToLower("UseKeychain"):                      true,
-	strings.ToLower("UsePrivilegedPort"):                true,
-	strings.ToLower("VisualHostKey"):                    true,
-}
-
-var uints = map[string]bool{
-	strings.ToLower("CanonicalizeMaxDots"):     true,
-	strings.ToLower("CompressionLevel"):        true, // 1 to 9
-	strings.ToLower("ConnectionAttempts"):      true,
-	strings.ToLower("ConnectTimeout"):          true,
-	strings.ToLower("NumberOfPasswordPrompts"): true,
-	strings.ToLower("Port"):                    true,
-	strings.ToLower("ServerAliveCountMax"):     true,
-	strings.ToLower("ServerAliveInterval"):     true,
-}
-
-func mustBeYesOrNo(lkey string) bool {
-	return yesnos[lkey]
-}
-
-func mustBeUint(lkey string) bool {
-	return uints[lkey]
-}
-
-func validate(key, val string) error {
-	lkey := strings.ToLower(key)
-	if mustBeYesOrNo(lkey) && (val != "yes" && val != "no") {
-		return fmt.Errorf("ssh_config: value for key %q must be 'yes' or 'no', got %q", key, val)
-	}
-	if mustBeUint(lkey) {
-		_, err := strconv.ParseUint(val, 10, 64)
-		if err != nil {
-			return fmt.Errorf("ssh_config: %v", err)
-		}
-	}
-	return nil
-}
-
-var defaults = map[string]string{
-	strings.ToLower("AddKeysToAgent"):                  "no",
-	strings.ToLower("AddressFamily"):                   "any",
-	strings.ToLower("BatchMode"):                       "no",
-	strings.ToLower("CanonicalizeFallbackLocal"):       "yes",
-	strings.ToLower("CanonicalizeHostname"):            "no",
-	strings.ToLower("CanonicalizeMaxDots"):             "1",
-	strings.ToLower("ChallengeResponseAuthentication"): "yes",
-	strings.ToLower("CheckHostIP"):                     "yes",
-	// TODO is this still the correct cipher
-	strings.ToLower("Cipher"):                    "3des",
-	strings.ToLower("Ciphers"):                   "[email protected],aes128-ctr,aes192-ctr,aes256-ctr,[email protected],[email protected],aes128-cbc,aes192-cbc,aes256-cbc",
-	strings.ToLower("ClearAllForwardings"):       "no",
-	strings.ToLower("Compression"):               "no",
-	strings.ToLower("CompressionLevel"):          "6",
-	strings.ToLower("ConnectionAttempts"):        "1",
-	strings.ToLower("ControlMaster"):             "no",
-	strings.ToLower("EnableSSHKeysign"):          "no",
-	strings.ToLower("EscapeChar"):                "~",
-	strings.ToLower("ExitOnForwardFailure"):      "no",
-	strings.ToLower("FingerprintHash"):           "sha256",
-	strings.ToLower("ForwardAgent"):              "no",
-	strings.ToLower("ForwardX11"):                "no",
-	strings.ToLower("ForwardX11Timeout"):         "20m",
-	strings.ToLower("ForwardX11Trusted"):         "no",
-	strings.ToLower("GatewayPorts"):              "no",
-	strings.ToLower("GlobalKnownHostsFile"):      "/etc/ssh/ssh_known_hosts /etc/ssh/ssh_known_hosts2",
-	strings.ToLower("GSSAPIAuthentication"):      "no",
-	strings.ToLower("GSSAPIDelegateCredentials"): "no",
-	strings.ToLower("HashKnownHosts"):            "no",
-	strings.ToLower("HostbasedAuthentication"):   "no",
-
-	strings.ToLower("HostbasedKeyTypes"): "[email protected],[email protected],[email protected],[email protected],[email protected],ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,ssh-ed25519,ssh-rsa",
-	strings.ToLower("HostKeyAlgorithms"): "[email protected],[email protected],[email protected],[email protected],[email protected],ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,ssh-ed25519,ssh-rsa",
-	// HostName has a dynamic default (the value passed at the command line).
-
-	strings.ToLower("IdentitiesOnly"): "no",
-	strings.ToLower("IdentityFile"):   "~/.ssh/identity",
-
-	// IPQoS has a dynamic default based on interactive or non-interactive
-	// sessions.
-
-	strings.ToLower("KbdInteractiveAuthentication"): "yes",
-
-	strings.ToLower("KexAlgorithms"): "curve25519-sha256,[email protected],ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1",
-	strings.ToLower("LogLevel"):      "INFO",
-	strings.ToLower("MACs"):          "[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-sha1",
-
-	strings.ToLower("NoHostAuthenticationForLocalhost"): "no",
-	strings.ToLower("NumberOfPasswordPrompts"):          "3",
-	strings.ToLower("PasswordAuthentication"):           "yes",
-	strings.ToLower("PermitLocalCommand"):               "no",
-	strings.ToLower("Port"):                             "22",
-
-	strings.ToLower("PreferredAuthentications"): "gssapi-with-mic,hostbased,publickey,keyboard-interactive,password",
-	strings.ToLower("Protocol"):                 "2",
-	strings.ToLower("ProxyUseFdpass"):           "no",
-	strings.ToLower("PubkeyAcceptedKeyTypes"):   "[email protected],[email protected],[email protected],[email protected],[email protected],ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,ssh-ed25519,ssh-rsa",
-	strings.ToLower("PubkeyAuthentication"):     "yes",
-	strings.ToLower("RekeyLimit"):               "default none",
-	strings.ToLower("RhostsRSAAuthentication"):  "no",
-	strings.ToLower("RSAAuthentication"):        "yes",
-
-	strings.ToLower("ServerAliveCountMax"):   "3",
-	strings.ToLower("ServerAliveInterval"):   "0",
-	strings.ToLower("StreamLocalBindMask"):   "0177",
-	strings.ToLower("StreamLocalBindUnlink"): "no",
-	strings.ToLower("StrictHostKeyChecking"): "ask",
-	strings.ToLower("TCPKeepAlive"):          "yes",
-	strings.ToLower("Tunnel"):                "no",
-	strings.ToLower("TunnelDevice"):          "any:any",
-	strings.ToLower("UpdateHostKeys"):        "no",
-	strings.ToLower("UseKeychain"):           "no",
-	strings.ToLower("UsePrivilegedPort"):     "no",
-
-	strings.ToLower("UserKnownHostsFile"): "~/.ssh/known_hosts ~/.ssh/known_hosts2",
-	strings.ToLower("VerifyHostKeyDNS"):   "no",
-	strings.ToLower("VisualHostKey"):      "no",
-	strings.ToLower("XAuthLocation"):      "/usr/X11R6/bin/xauth",
-}

+ 0 - 21
bashbrew/go/vendor/github.com/mitchellh/go-homedir/LICENSE

@@ -1,21 +0,0 @@
-The MIT License (MIT)
-
-Copyright (c) 2013 Mitchell Hashimoto
-
-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 - 14
bashbrew/go/vendor/github.com/mitchellh/go-homedir/README.md

@@ -1,14 +0,0 @@
-# go-homedir
-
-This is a Go library for detecting the user's home directory without
-the use of cgo, so the library can be used in cross-compilation environments.
-
-Usage is incredibly simple, just call `homedir.Dir()` to get the home directory
-for a user, and `homedir.Expand()` to expand the `~` in a path to the home
-directory.
-
-**Why not just use `os/user`?** The built-in `os/user` package requires
-cgo on Darwin systems. This means that any Go code that uses that package
-cannot cross compile. But 99% of the time the use for `os/user` is just to
-retrieve the home directory, which we can do for the current user without
-cgo. This library does that, enabling cross-compilation.

+ 0 - 1
bashbrew/go/vendor/github.com/mitchellh/go-homedir/go.mod

@@ -1 +0,0 @@
-module github.com/mitchellh/go-homedir

+ 0 - 157
bashbrew/go/vendor/github.com/mitchellh/go-homedir/homedir.go

@@ -1,157 +0,0 @@
-package homedir
-
-import (
-	"bytes"
-	"errors"
-	"os"
-	"os/exec"
-	"path/filepath"
-	"runtime"
-	"strconv"
-	"strings"
-	"sync"
-)
-
-// DisableCache will disable caching of the home directory. Caching is enabled
-// by default.
-var DisableCache bool
-
-var homedirCache string
-var cacheLock sync.RWMutex
-
-// Dir returns the home directory for the executing user.
-//
-// This uses an OS-specific method for discovering the home directory.
-// An error is returned if a home directory cannot be detected.
-func Dir() (string, error) {
-	if !DisableCache {
-		cacheLock.RLock()
-		cached := homedirCache
-		cacheLock.RUnlock()
-		if cached != "" {
-			return cached, nil
-		}
-	}
-
-	cacheLock.Lock()
-	defer cacheLock.Unlock()
-
-	var result string
-	var err error
-	if runtime.GOOS == "windows" {
-		result, err = dirWindows()
-	} else {
-		// Unix-like system, so just assume Unix
-		result, err = dirUnix()
-	}
-
-	if err != nil {
-		return "", err
-	}
-	homedirCache = result
-	return result, nil
-}
-
-// Expand expands the path to include the home directory if the path
-// is prefixed with `~`. If it isn't prefixed with `~`, the path is
-// returned as-is.
-func Expand(path string) (string, error) {
-	if len(path) == 0 {
-		return path, nil
-	}
-
-	if path[0] != '~' {
-		return path, nil
-	}
-
-	if len(path) > 1 && path[1] != '/' && path[1] != '\\' {
-		return "", errors.New("cannot expand user-specific home dir")
-	}
-
-	dir, err := Dir()
-	if err != nil {
-		return "", err
-	}
-
-	return filepath.Join(dir, path[1:]), nil
-}
-
-func dirUnix() (string, error) {
-	homeEnv := "HOME"
-	if runtime.GOOS == "plan9" {
-		// On plan9, env vars are lowercase.
-		homeEnv = "home"
-	}
-
-	// First prefer the HOME environmental variable
-	if home := os.Getenv(homeEnv); home != "" {
-		return home, nil
-	}
-
-	var stdout bytes.Buffer
-
-	// If that fails, try OS specific commands
-	if runtime.GOOS == "darwin" {
-		cmd := exec.Command("sh", "-c", `dscl -q . -read /Users/"$(whoami)" NFSHomeDirectory | sed 's/^[^ ]*: //'`)
-		cmd.Stdout = &stdout
-		if err := cmd.Run(); err == nil {
-			result := strings.TrimSpace(stdout.String())
-			if result != "" {
-				return result, nil
-			}
-		}
-	} else {
-		cmd := exec.Command("getent", "passwd", strconv.Itoa(os.Getuid()))
-		cmd.Stdout = &stdout
-		if err := cmd.Run(); err != nil {
-			// If the error is ErrNotFound, we ignore it. Otherwise, return it.
-			if err != exec.ErrNotFound {
-				return "", err
-			}
-		} else {
-			if passwd := strings.TrimSpace(stdout.String()); passwd != "" {
-				// username:password:uid:gid:gecos:home:shell
-				passwdParts := strings.SplitN(passwd, ":", 7)
-				if len(passwdParts) > 5 {
-					return passwdParts[5], nil
-				}
-			}
-		}
-	}
-
-	// If all else fails, try the shell
-	stdout.Reset()
-	cmd := exec.Command("sh", "-c", "cd && pwd")
-	cmd.Stdout = &stdout
-	if err := cmd.Run(); err != nil {
-		return "", err
-	}
-
-	result := strings.TrimSpace(stdout.String())
-	if result == "" {
-		return "", errors.New("blank output when reading home directory")
-	}
-
-	return result, nil
-}
-
-func dirWindows() (string, error) {
-	// First prefer the HOME environmental variable
-	if home := os.Getenv("HOME"); home != "" {
-		return home, nil
-	}
-
-	// Prefer standard environment variable USERPROFILE
-	if home := os.Getenv("USERPROFILE"); home != "" {
-		return home, nil
-	}
-
-	drive := os.Getenv("HOMEDRIVE")
-	path := os.Getenv("HOMEPATH")
-	home := drive + path
-	if drive == "" || path == "" {
-		return "", errors.New("HOMEDRIVE, HOMEPATH, or USERPROFILE are blank")
-	}
-
-	return home, nil
-}

+ 0 - 1
bashbrew/go/vendor/github.com/pelletier/go-buffruneio/.gitignore

@@ -1 +0,0 @@
-*.test

+ 0 - 7
bashbrew/go/vendor/github.com/pelletier/go-buffruneio/.travis.yml

@@ -1,7 +0,0 @@
-language: go
-sudo: false
-go:
-    - 1.3.3
-    - 1.4.3
-    - 1.5.3
-    - tip

+ 0 - 62
bashbrew/go/vendor/github.com/pelletier/go-buffruneio/README.md

@@ -1,62 +0,0 @@
-# buffruneio
-
-[![Tests Status](https://travis-ci.org/pelletier/go-buffruneio.svg?branch=master)](https://travis-ci.org/pelletier/go-buffruneio)
-[![GoDoc](https://godoc.org/github.com/pelletier/go-buffruneio?status.svg)](https://godoc.org/github.com/pelletier/go-buffruneio)
-
-Buffruneio is a wrapper around bufio to provide buffered runes access with
-unlimited unreads.
-
-```go
-import "github.com/pelletier/go-buffruneio"
-```
-
-## Examples
-
-```go
-import (
-    "fmt"
-    "github.com/pelletier/go-buffruneio"
-    "strings"
-)
-
-reader := buffruneio.NewReader(strings.NewReader("abcd"))
-fmt.Println(reader.ReadRune()) // 'a'
-fmt.Println(reader.ReadRune()) // 'b'
-fmt.Println(reader.ReadRune()) // 'c'
-reader.UnreadRune()
-reader.UnreadRune()
-fmt.Println(reader.ReadRune()) // 'b'
-fmt.Println(reader.ReadRune()) // 'c'
-```
-
-## Documentation
-
-The documentation and additional examples are available at
-[godoc.org](http://godoc.org/github.com/pelletier/go-buffruneio).
-
-## Contribute
-
-Feel free to report bugs and patches using GitHub's pull requests system on
-[pelletier/go-toml](https://github.com/pelletier/go-buffruneio). Any feedback is
-much appreciated!
-
-## LICENSE
-
-Copyright (c) 2016 Thomas Pelletier
-
-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 - 117
bashbrew/go/vendor/github.com/pelletier/go-buffruneio/buffruneio.go

@@ -1,117 +0,0 @@
-// Package buffruneio is a wrapper around bufio to provide buffered runes access with unlimited unreads.
-package buffruneio
-
-import (
-	"bufio"
-	"container/list"
-	"errors"
-	"io"
-)
-
-// Rune to indicate end of file.
-const (
-	EOF = -(iota + 1)
-)
-
-// ErrNoRuneToUnread is returned by UnreadRune() when the read index is already at the beginning of the buffer.
-var ErrNoRuneToUnread = errors.New("no rune to unwind")
-
-// Reader implements runes buffering for an io.Reader object.
-type Reader struct {
-	buffer  *list.List
-	current *list.Element
-	input   *bufio.Reader
-}
-
-// NewReader returns a new Reader.
-func NewReader(rd io.Reader) *Reader {
-	return &Reader{
-		buffer: list.New(),
-		input:  bufio.NewReader(rd),
-	}
-}
-
-type runeWithSize struct {
-	r    rune
-	size int
-}
-
-func (rd *Reader) feedBuffer() error {
-	r, size, err := rd.input.ReadRune()
-
-	if err != nil {
-		if err != io.EOF {
-			return err
-		}
-		r = EOF
-	}
-
-	newRuneWithSize := runeWithSize{r, size}
-
-	rd.buffer.PushBack(newRuneWithSize)
-	if rd.current == nil {
-		rd.current = rd.buffer.Back()
-	}
-	return nil
-}
-
-// ReadRune reads the next rune from buffer, or from the underlying reader if needed.
-func (rd *Reader) ReadRune() (rune, int, error) {
-	if rd.current == rd.buffer.Back() || rd.current == nil {
-		err := rd.feedBuffer()
-		if err != nil {
-			return EOF, 0, err
-		}
-	}
-
-	runeWithSize := rd.current.Value.(runeWithSize)
-	rd.current = rd.current.Next()
-	return runeWithSize.r, runeWithSize.size, nil
-}
-
-// UnreadRune pushes back the previously read rune in the buffer, extending it if needed.
-func (rd *Reader) UnreadRune() error {
-	if rd.current == rd.buffer.Front() {
-		return ErrNoRuneToUnread
-	}
-	if rd.current == nil {
-		rd.current = rd.buffer.Back()
-	} else {
-		rd.current = rd.current.Prev()
-	}
-	return nil
-}
-
-// Forget removes runes stored before the current stream position index.
-func (rd *Reader) Forget() {
-	if rd.current == nil {
-		rd.current = rd.buffer.Back()
-	}
-	for ; rd.current != rd.buffer.Front(); rd.buffer.Remove(rd.current.Prev()) {
-	}
-}
-
-// PeekRune returns at most the next n runes, reading from the uderlying source if
-// needed. Does not move the current index. It includes EOF if reached.
-func (rd *Reader) PeekRunes(n int) []rune {
-	res := make([]rune, 0, n)
-	cursor := rd.current
-	for i := 0; i < n; i++ {
-		if cursor == nil {
-			err := rd.feedBuffer()
-			if err != nil {
-				return res
-			}
-			cursor = rd.buffer.Back()
-		}
-		if cursor != nil {
-			r := cursor.Value.(runeWithSize).r
-			res = append(res, r)
-			if r == EOF {
-				return res
-			}
-			cursor = cursor.Next()
-		}
-	}
-	return res
-}

部分文件因为文件数量过多而无法显示