From aea859372cab0b926ad4e25331273fe740af1997 Mon Sep 17 00:00:00 2001 From: Alec Thomas Date: Sat, 19 May 2018 20:04:51 +1000 Subject: [PATCH] Switch to circleci. --- .circleci/config.yml | 11 +++++++++++ README.md | 2 +- help.go | 2 ++ kong.go | 1 + 4 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 .circleci/config.yml diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 0000000..0813982 --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,11 @@ +version: 2 +jobs: + build: + docker: + - image: circleci/golang:1.10 + + working_directory: /go/src/github.com/alecthomas/kong + steps: + - checkout + - run: go get -v -t -d ./... + - run: go test -v ./... diff --git a/README.md b/README.md index a6a39b8..5ef36e4 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Kong is a command-line parser for Go +# Kong is a command-line parser for Go [![CircleCI](https://circleci.com/gh/alecthomas/kong.svg?style=svg&circle-token=477fecac758383bf281453187269b913130f17d2)](https://circleci.com/gh/alecthomas/kong) It parses a command-line into a struct. eg. diff --git a/help.go b/help.go index 6332bef..7066aa8 100644 --- a/help.go +++ b/help.go @@ -8,6 +8,8 @@ import ( const defaultHelp = `{{- with .Application -}} usage: {{.Name}} +{{.Help}} + {{- end -}} ` diff --git a/kong.go b/kong.go index 22d854c..b150b8e 100644 --- a/kong.go +++ b/kong.go @@ -109,6 +109,7 @@ func (k *Kong) applyNode(scan *Scanner, node *Node, flags []*Flag) (command []st } args = append(args, token.Value) } + // Note: tokens must be pushed in reverse order. for i := range args { scan.PushTyped(args[len(args)-1-i], PositionalArgumentToken) }