From 3eee4a466e388ce08db9f36702d16ebcd7d1eb26 Mon Sep 17 00:00:00 2001 From: "lynn [they]" Date: Wed, 18 Dec 2019 18:09:40 -0800 Subject: [PATCH 01/18] Update cli.yml --- .github/workflows/cli.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/cli.yml b/.github/workflows/cli.yml index 826762c..90a8115 100644 --- a/.github/workflows/cli.yml +++ b/.github/workflows/cli.yml @@ -45,19 +45,20 @@ jobs: chmod +x $GOPATH/bin/gfmrun npm install markdown-toc - - name: Run Tests (v1) - if: contains(github.base_ref, 'v1') + - name: Run Tests run: | go run build.go vet go run build.go test + + - name: Run Tests (v1) + if: contains(github.base_ref, 'v1') + run: | go run build.go gfmrun docs/v1/manual.md go run build.go toc docs/v1/manual.md - name: Run Tests (v2) if: contains(github.base_ref, 'master') run: | - go run build.go vet - go run build.go test go run build.go gfmrun docs/v2/manual.md go run build.go toc docs/v2/manual.md From dd803d3ea33f6dc789257182e57890a0aca15eee Mon Sep 17 00:00:00 2001 From: "lynn [they]" Date: Tue, 24 Dec 2019 01:22:07 -0800 Subject: [PATCH 02/18] Update README.md --- README.md | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 4762323..5d24156 100644 --- a/README.md +++ b/README.md @@ -20,6 +20,12 @@ Usage documentation exists for each major version. Don't know what version you'r - `v2` - [./docs/v2/manual.md](./docs/v2/manual.md) - `v1` - [./docs/v1/manual.md](./docs/v1/manual.md) +## Installation + +Make sure you have a working Go environment. Go version 1.11+ is supported. [See the install instructions for Go](http://golang.org/doc/install.html). + +Go Modules are strongly recommended when using this package. [See the go blog guide on using Go Modules](https://blog.golang.org/using-go-modules). + ### Using `v2` releases ``` @@ -37,7 +43,7 @@ import ( ### Using `v1` releases ``` -$ go get github.com/urfave/cli +$ GO111MODULE=on go get github.com/urfave/cli ``` ```go @@ -48,11 +54,6 @@ import ( ... ``` -## Installation - -Make sure you have a working Go environment. Go version 1.10+ is supported. [See -the install instructions for Go](http://golang.org/doc/install.html). - ### GOPATH Make sure your `PATH` includes the `$GOPATH/bin` directory so your commands can From 8bb9d2149a8f75b0fda974c1dea233d7aae072fb Mon Sep 17 00:00:00 2001 From: "lynn [they]" Date: Tue, 24 Dec 2019 02:07:27 -0800 Subject: [PATCH 03/18] Update README.md --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index 4762323..cb45948 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,6 @@ 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) From 93fe02a2720224b3c70b262b25f4755c10d7de23 Mon Sep 17 00:00:00 2001 From: "lynn [they]" Date: Tue, 24 Dec 2019 03:59:10 -0800 Subject: [PATCH 04/18] Update CHANGELOG.md --- docs/CHANGELOG.md | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 9aee16f..d46619a 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -6,6 +6,25 @@ View [unreleased 2.X] series changes. +## [2.1.0] - 2019-12-24 + +### Fixed + +* Fixed some golint errors in [urfave/cli/pull/988](https://github.com/urfave/cli/pull/988) via [@liamchampton](https://github.com/liamchampton) +* Fixed a panic with flag completion [urfave/cli/pull/946](https://github.com/urfave/cli/pull/946) via [@unRob](https://github.com/unRob) + +### Changed + +* Changed docs generation to use visible flags in [urfave/cli/pull/999](https://github.com/urfave/cli/pull/999) via [@subpop](https://github.com/subpop) +* Changed `App.Run` to use an optional context for timeouts and cancellation in [urfave/cli/pull/975](https://github.com/urfave/cli/pull/975) via [@marwan-at-work](https://github.com/marwan-at-work) +* Changed version info to be hidden if the user has not defined a version in [urfave/cli/pull/955](https://github.com/urfave/cli/pull/955) via [@asahasrabuddhe](https://github.com/asahasrabuddhe) +* Changed docs generation to take into account multiple authors in [urfave/cli/pull/900](https://github.com/urfave/cli/pull/900) via [@saschagrunert](https://github.com/saschagrunert) +* Changed context to expose a `Value` accessor in [urfave/cli/pull/741](https://github.com/urfave/cli/pull/741) via [@corruptmemory](https://github.com/corruptmemory) + +### Added + +* Added timestamp flag in [urfave/cli/pull/987](https://github.com/urfave/cli/pull/987) via [@drov0](https://github.com/drov0) + ## [2.0.0] - 2019-11-17 The V2 changes were all shipped in [urfave/cli/pull/892](https://github.com/urfave/cli/pull/892), which was created with the effort of over a dozen participants! They are: @@ -520,7 +539,8 @@ signature of `func(*cli.Context) error`, as defined by `cli.ActionFunc`. ### Added - Initial implementation. -[unreleased 2.X]: https://github.com/urfave/cli/compare/v2.0.0...HEAD +[unreleased 2.X]: https://github.com/urfave/cli/compare/v2.1.0...HEAD +[2.1.0]: https://github.com/urfave/cli/compare/v2.0.0...v2.1.0 [2.0.0]: https://github.com/urfave/cli/compare/v1.22.2...v2.0.0 [unreleased 1.22.X]: https://github.com/urfave/cli/compare/v1.22.2...v1 From eed2043467b2444cd9a949a3207fbff5eb54ff82 Mon Sep 17 00:00:00 2001 From: "lynn [they]" Date: Tue, 24 Dec 2019 04:01:27 -0800 Subject: [PATCH 05/18] Update CHANGELOG.md --- docs/CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index d46619a..ceb381f 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -8,6 +8,8 @@ View [unreleased 2.X] series changes. ## [2.1.0] - 2019-12-24 +These release notes were written for the git hash [ae84df4cef4a2a6f1a0cb1d41ea0f3af8755e5a8](https://github.com/urfave/cli/tree/ae84df4cef4a2a6f1a0cb1d41ea0f3af8755e5a8) + ### Fixed * Fixed some golint errors in [urfave/cli/pull/988](https://github.com/urfave/cli/pull/988) via [@liamchampton](https://github.com/liamchampton) From 49db826a05b1fc34d466cd4d8d6b893fe833c802 Mon Sep 17 00:00:00 2001 From: "lynn [they]" Date: Tue, 24 Dec 2019 06:13:41 -0800 Subject: [PATCH 06/18] Update manual.md --- docs/v2/manual.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/v2/manual.md b/docs/v2/manual.md index 5e04d4e..512ad57 100644 --- a/docs/v2/manual.md +++ b/docs/v2/manual.md @@ -1,6 +1,8 @@ cli v2 manual === +todo + - [Getting Started](#getting-started) From b44b656820e88ee033a64813725d07bf301c25dc Mon Sep 17 00:00:00 2001 From: Lynn Cyrin Date: Tue, 24 Dec 2019 07:22:30 -0800 Subject: [PATCH 07/18] failing test --- context_test.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/context_test.go b/context_test.go index 3cefcca..7bb30e1 100644 --- a/context_test.go +++ b/context_test.go @@ -293,6 +293,13 @@ func TestContext_Lineage(t *testing.T) { expect(t, lineage[1], parentCtx) } +func TestContext_BackgroundContextAttributeAccessing(t *testing.T) { + parentContext := context.Background() + ctx := NewContext(nil, nil, &Context{Context: parentContext}) + value := ctx.Bool("some-bool") + expect(t, value, false) +} + func TestContext_lookupFlagSet(t *testing.T) { set := flag.NewFlagSet("test", 0) set.Bool("local-flag", false, "doc") From 5e433e09e68e05ec9efb8e4c845134f734a71106 Mon Sep 17 00:00:00 2001 From: Lynn Cyrin Date: Tue, 24 Dec 2019 07:23:17 -0800 Subject: [PATCH 08/18] Revert "Update manual.md" This reverts commit 49db826a05b1fc34d466cd4d8d6b893fe833c802. --- docs/v2/manual.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/docs/v2/manual.md b/docs/v2/manual.md index 512ad57..5e04d4e 100644 --- a/docs/v2/manual.md +++ b/docs/v2/manual.md @@ -1,8 +1,6 @@ cli v2 manual === -todo - - [Getting Started](#getting-started) From 7b57234c15257477d4539f2447173bc65d7b1e11 Mon Sep 17 00:00:00 2001 From: Lynn Cyrin Date: Tue, 24 Dec 2019 07:23:36 -0800 Subject: [PATCH 09/18] update gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index b013e4a..5c9c00a 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ node_modules/ vendor .idea +coverage.txt From b62c6419cbe25e1b792ef9fa298c8e8c70d87251 Mon Sep 17 00:00:00 2001 From: Lynn Cyrin Date: Tue, 24 Dec 2019 07:49:37 -0800 Subject: [PATCH 10/18] new tests --- context.go | 7 +++++- context_test.go | 58 +++++++++++++++++++++++++++++++++++++++++++------ 2 files changed, 57 insertions(+), 8 deletions(-) diff --git a/context.go b/context.go index 5b59e75..e1cf3da 100644 --- a/context.go +++ b/context.go @@ -24,7 +24,12 @@ type Context struct { // 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} + c := &Context{ + App: app, + flagSet: set, + parentContext: parentCtx, + } + if parentCtx != nil { c.Context = parentCtx.Context c.shellComplete = parentCtx.shellComplete diff --git a/context_test.go b/context_test.go index 7bb30e1..818cb5a 100644 --- a/context_test.go +++ b/context_test.go @@ -293,13 +293,6 @@ func TestContext_Lineage(t *testing.T) { expect(t, lineage[1], parentCtx) } -func TestContext_BackgroundContextAttributeAccessing(t *testing.T) { - parentContext := context.Background() - ctx := NewContext(nil, nil, &Context{Context: parentContext}) - value := ctx.Bool("some-bool") - expect(t, value, false) -} - func TestContext_lookupFlagSet(t *testing.T) { set := flag.NewFlagSet("test", 0) set.Bool("local-flag", false, "doc") @@ -351,6 +344,57 @@ func TestContextPropagation(t *testing.T) { } } +func TestContextAttributeAccessing(t *testing.T) { + tdata := []struct { + testCase string + setBoolInput string + ctxBoolInput string + newContextInput *Context + }{ + { + testCase: "empty", + setBoolInput: "", + ctxBoolInput: "", + newContextInput: nil, + }, + { + testCase: "empty_with_background_context", + setBoolInput: "", + ctxBoolInput: "", + newContextInput: &Context{Context: context.Background()}, + }, + { + testCase: "empty_set_bool_and_present_ctx_bool", + setBoolInput: "", + ctxBoolInput: "ctx-bool", + newContextInput: nil, + }, + { + testCase: "empty_set_bool_and_present_ctx_bool_with_background_context", + setBoolInput: "", + ctxBoolInput: "ctx-bool", + newContextInput: &Context{Context: context.Background()}, + }, + } + + for _, test := range tdata { + t.Run(test.testCase, func(t *testing.T) { + // setup + set := flag.NewFlagSet("test", 0) + set.Bool(test.setBoolInput, false, "doc") + ctx := NewContext(nil, set, test.newContextInput) + + // logic under test + value := ctx.Bool(test.ctxBoolInput) + + // assertions + if value != false { + t.Errorf("expected test.value to be false, but it was not") + } + }) + } +} + func TestCheckRequiredFlags(t *testing.T) { tdata := []struct { testCase string From 1651eec7b89a7e727630b8b2591d91d7346dc40a Mon Sep 17 00:00:00 2001 From: Lynn Cyrin Date: Tue, 24 Dec 2019 08:53:59 -0800 Subject: [PATCH 11/18] add a fix --- context.go | 4 ++++ context_test.go | 6 +++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/context.go b/context.go index e1cf3da..4d8c023 100644 --- a/context.go +++ b/context.go @@ -33,6 +33,10 @@ func NewContext(app *App, set *flag.FlagSet, parentCtx *Context) *Context { if parentCtx != nil { c.Context = parentCtx.Context c.shellComplete = parentCtx.shellComplete + + if parentCtx.flagSet == nil { + parentCtx.flagSet = &flag.FlagSet{} + } } c.Command = &Command{} diff --git a/context_test.go b/context_test.go index 818cb5a..8f255eb 100644 --- a/context_test.go +++ b/context_test.go @@ -380,8 +380,8 @@ func TestContextAttributeAccessing(t *testing.T) { for _, test := range tdata { t.Run(test.testCase, func(t *testing.T) { // setup - set := flag.NewFlagSet("test", 0) - set.Bool(test.setBoolInput, false, "doc") + set := flag.NewFlagSet("some-flag-set-name", 0) + set.Bool(test.setBoolInput, false, "usage documentation") ctx := NewContext(nil, set, test.newContextInput) // logic under test @@ -389,7 +389,7 @@ func TestContextAttributeAccessing(t *testing.T) { // assertions if value != false { - t.Errorf("expected test.value to be false, but it was not") + t.Errorf("expected \"value\" to be false, but it was not") } }) } From 9eb7426ac304058926bc6ee3eb0b3bf99530d4f6 Mon Sep 17 00:00:00 2001 From: Lynn Cyrin Date: Tue, 24 Dec 2019 08:55:31 -0800 Subject: [PATCH 12/18] add a fix --- context_test.go | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/context_test.go b/context_test.go index 8f255eb..ccf8846 100644 --- a/context_test.go +++ b/context_test.go @@ -370,11 +370,35 @@ func TestContextAttributeAccessing(t *testing.T) { newContextInput: nil, }, { - testCase: "empty_set_bool_and_present_ctx_bool_with_background_context", + testCase: "present_set_bool_and_present_ctx_bool_with_background_context", setBoolInput: "", ctxBoolInput: "ctx-bool", newContextInput: &Context{Context: context.Background()}, }, + { + testCase: "present_set_bool_and_present_ctx_bool", + setBoolInput: "ctx-bool", + ctxBoolInput: "ctx-bool", + newContextInput: nil, + }, + { + testCase: "present_set_bool_and_present_ctx_bool_with_background_context", + setBoolInput: "ctx-bool", + ctxBoolInput: "ctx-bool", + newContextInput: &Context{Context: context.Background()}, + }, + { + testCase: "present_set_bool_and_different_ctx_bool", + setBoolInput: "ctx-bool", + ctxBoolInput: "not-ctx-bool", + newContextInput: nil, + }, + { + testCase: "present_set_bool_and_different_ctx_bool_with_background_context", + setBoolInput: "ctx-bool", + ctxBoolInput: "not-ctx-bool", + newContextInput: &Context{Context: context.Background()}, + }, } for _, test := range tdata { From 5d74b7723ac465d1cce7f13408a3abfba592ed58 Mon Sep 17 00:00:00 2001 From: Lynn Cyrin Date: Tue, 24 Dec 2019 08:56:36 -0800 Subject: [PATCH 13/18] reduce diff --- context.go | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/context.go b/context.go index 4d8c023..4fe9568 100644 --- a/context.go +++ b/context.go @@ -24,11 +24,7 @@ type Context struct { // 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, - } + c := &Context{App: app, flagSet: set, parentContext: parentCtx} if parentCtx != nil { c.Context = parentCtx.Context From 11777de30c8e2529666650b871dd37f00e2423ba Mon Sep 17 00:00:00 2001 From: Lynn Cyrin Date: Tue, 24 Dec 2019 08:58:27 -0800 Subject: [PATCH 14/18] reduce diff --- .gitignore | 1 - 1 file changed, 1 deletion(-) diff --git a/.gitignore b/.gitignore index 5c9c00a..b013e4a 100644 --- a/.gitignore +++ b/.gitignore @@ -3,4 +3,3 @@ node_modules/ vendor .idea -coverage.txt From 35510ee0f9f9b436136d2e954ef2b9be585483e6 Mon Sep 17 00:00:00 2001 From: Lynn Cyrin Date: Tue, 24 Dec 2019 08:58:40 -0800 Subject: [PATCH 15/18] reduce diff --- context.go | 2 -- 1 file changed, 2 deletions(-) diff --git a/context.go b/context.go index 4fe9568..c0c526f 100644 --- a/context.go +++ b/context.go @@ -25,11 +25,9 @@ type Context struct { // 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.Context = parentCtx.Context c.shellComplete = parentCtx.shellComplete - if parentCtx.flagSet == nil { parentCtx.flagSet = &flag.FlagSet{} } From c806e29aa5f04b9da78a952293b2269518f66132 Mon Sep 17 00:00:00 2001 From: Lynn Cyrin Date: Tue, 24 Dec 2019 09:34:31 -0800 Subject: [PATCH 16/18] fix doc tests --- docs/v2/manual.md | 93 ++++++++++++++++++++++++----------------------- 1 file changed, 48 insertions(+), 45 deletions(-) diff --git a/docs/v2/manual.md b/docs/v2/manual.md index 5e04d4e..739a0e9 100644 --- a/docs/v2/manual.md +++ b/docs/v2/manual.md @@ -1401,51 +1401,54 @@ func main() { cli.ShowSubcommandHelp(c) cli.ShowVersion(c) - 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 c.Args().Len() > 0 { - fmt.Printf("%#v\n", c.Args().Get(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.Bool("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.FlagNames()) - fmt.Printf("%#v\n", nc.IsSet("wat")) - fmt.Printf("%#v\n", nc.Set("wat", "nope")) - fmt.Printf("%#v\n", nc.NArg()) - fmt.Printf("%#v\n", nc.NumFlags()) - fmt.Printf("%#v\n", nc.Lineage()[1]) - + fmt.Printf("%#v\n", c.App.Command("doo")) + // // uncomment when https://github.com/urfave/cli/pull/1014 is released + // if c.Bool("infinite") { + // c.App.Run([]string{"app", "doo", "wop"}) + // } + + // // uncomment when https://github.com/urfave/cli/pull/1014 is released + // 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 c.Args().Len() > 0 { + fmt.Printf("%#v\n", c.Args().Get(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) + + // // uncomment when https://github.com/urfave/cli/pull/1014 is released + // fmt.Printf("%#v\n", nc.Args()) + // fmt.Printf("%#v\n", nc.Bool("nope")) + // fmt.Printf("%#v\n", !nc.Bool("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")) + + // // uncomment when https://github.com/urfave/cli/pull/1014 is released + // fmt.Printf("%#v\n", nc.FlagNames()) + // fmt.Printf("%#v\n", nc.IsSet("wat")) + // fmt.Printf("%#v\n", nc.Set("wat", "nope")) + // fmt.Printf("%#v\n", nc.NArg()) + // fmt.Printf("%#v\n", nc.NumFlags()) + // fmt.Printf("%#v\n", nc.Lineage()[1]) nc.Set("wat", "also-nope") ec := cli.Exit("ohwell", 86) From b429f0381cc4ef88f7560a34103730ca33f1dc0b Mon Sep 17 00:00:00 2001 From: Lynn Cyrin Date: Tue, 24 Dec 2019 09:35:38 -0800 Subject: [PATCH 17/18] fix identation diff --- docs/v2/manual.md | 96 +++++++++++++++++++++++------------------------ 1 file changed, 48 insertions(+), 48 deletions(-) diff --git a/docs/v2/manual.md b/docs/v2/manual.md index 739a0e9..b04ae02 100644 --- a/docs/v2/manual.md +++ b/docs/v2/manual.md @@ -1401,54 +1401,54 @@ func main() { cli.ShowSubcommandHelp(c) cli.ShowVersion(c) - fmt.Printf("%#v\n", c.App.Command("doo")) - // // uncomment when https://github.com/urfave/cli/pull/1014 is released - // if c.Bool("infinite") { - // c.App.Run([]string{"app", "doo", "wop"}) - // } - - // // uncomment when https://github.com/urfave/cli/pull/1014 is released - // 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 c.Args().Len() > 0 { - fmt.Printf("%#v\n", c.Args().Get(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) - - // // uncomment when https://github.com/urfave/cli/pull/1014 is released - // fmt.Printf("%#v\n", nc.Args()) - // fmt.Printf("%#v\n", nc.Bool("nope")) - // fmt.Printf("%#v\n", !nc.Bool("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")) - - // // uncomment when https://github.com/urfave/cli/pull/1014 is released - // fmt.Printf("%#v\n", nc.FlagNames()) - // fmt.Printf("%#v\n", nc.IsSet("wat")) - // fmt.Printf("%#v\n", nc.Set("wat", "nope")) - // fmt.Printf("%#v\n", nc.NArg()) - // fmt.Printf("%#v\n", nc.NumFlags()) - // fmt.Printf("%#v\n", nc.Lineage()[1]) + fmt.Printf("%#v\n", c.App.Command("doo")) + // // uncomment when https://github.com/urfave/cli/pull/1014 is released + // if c.Bool("infinite") { + // c.App.Run([]string{"app", "doo", "wop"}) + // } + + // // uncomment when https://github.com/urfave/cli/pull/1014 is released + // 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 c.Args().Len() > 0 { + fmt.Printf("%#v\n", c.Args().Get(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) + + // // uncomment when https://github.com/urfave/cli/pull/1014 is released + // fmt.Printf("%#v\n", nc.Args()) + // fmt.Printf("%#v\n", nc.Bool("nope")) + // fmt.Printf("%#v\n", !nc.Bool("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")) + + // // uncomment when https://github.com/urfave/cli/pull/1014 is released + // fmt.Printf("%#v\n", nc.FlagNames()) + // fmt.Printf("%#v\n", nc.IsSet("wat")) + // fmt.Printf("%#v\n", nc.Set("wat", "nope")) + // fmt.Printf("%#v\n", nc.NArg()) + // fmt.Printf("%#v\n", nc.NumFlags()) + // fmt.Printf("%#v\n", nc.Lineage()[1]) nc.Set("wat", "also-nope") ec := cli.Exit("ohwell", 86) From 5b57b2bf679aa4a26e93c8b1f29e56147ca1b3fe Mon Sep 17 00:00:00 2001 From: Lynn Cyrin Date: Tue, 24 Dec 2019 09:46:31 -0800 Subject: [PATCH 18/18] add changelog --- docs/CHANGELOG.md | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index ceb381f..383507d 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -6,6 +6,12 @@ View [unreleased 2.X] series changes. +## [2.1.1] - 2019-12-24 + +### Fixed + +* Fixed a `Context` regression introduced in `v2.1.0` in [urfave/cli/pull/1014](https://github.com/urfave/cli/pull/1014) via [@lynncyrin](https://github.com/lynncyrin) + ## [2.1.0] - 2019-12-24 These release notes were written for the git hash [ae84df4cef4a2a6f1a0cb1d41ea0f3af8755e5a8](https://github.com/urfave/cli/tree/ae84df4cef4a2a6f1a0cb1d41ea0f3af8755e5a8) @@ -541,7 +547,8 @@ signature of `func(*cli.Context) error`, as defined by `cli.ActionFunc`. ### Added - Initial implementation. -[unreleased 2.X]: https://github.com/urfave/cli/compare/v2.1.0...HEAD +[unreleased 2.X]: https://github.com/urfave/cli/compare/v2.1.1...HEAD +[2.1.1]: https://github.com/urfave/cli/compare/v2.1.0...v2.1.1 [2.1.0]: https://github.com/urfave/cli/compare/v2.0.0...v2.1.0 [2.0.0]: https://github.com/urfave/cli/compare/v1.22.2...v2.0.0