From 8825abfc4e70f610a393805471e2a8e292d795e6 Mon Sep 17 00:00:00 2001 From: Joe Gregorio Date: Sat, 30 Jan 2021 12:15:32 -0500 Subject: [PATCH] Fix urfavecli.LogFlags Now that https://github.com/urfave/cli/pull/1210 has landed. Change-Id: If8bffcb2e470e2d7285a4d2c8f1672650f0ec43f Reviewed-on: https://skia-review.googlesource.com/c/buildbot/+/363156 Auto-Submit: Joe Gregorio Reviewed-by: Ravi Mistry Commit-Queue: Ravi Mistry --- go/urfavecli/urfavecli.go | 7 +++++-- go/urfavecli/urfavecli_test.go | 1 + 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/go/urfavecli/urfavecli.go b/go/urfavecli/urfavecli.go index 47c839794af..b7a17417530 100644 --- a/go/urfavecli/urfavecli.go +++ b/go/urfavecli/urfavecli.go @@ -20,11 +20,14 @@ import ( // }, // }, func LogFlags(cliContext *cli.Context) { + for _, flag := range cliContext.App.Flags { + name := flag.Names()[0] + sklog.Infof("App Flags: --%s=%v", name, cliContext.Value(name)) + } for _, flag := range cliContext.Command.Flags { name := flag.Names()[0] - sklog.Infof("Flags: --%s=%v", name, cliContext.Value(name)) + sklog.Infof("Command Flags: --%s=%v", name, cliContext.Value(name)) } - } // MarkdownDocTemplate is a common template used to format commands as Markdown. diff --git a/go/urfavecli/urfavecli_test.go b/go/urfavecli/urfavecli_test.go index d777e55a03e..3b8f6185c48 100644 --- a/go/urfavecli/urfavecli_test.go +++ b/go/urfavecli/urfavecli_test.go @@ -161,6 +161,7 @@ func TestLogFlags(t *testing.T) { } expected := []string{ + " --help=false", " --boolNotPassedIn=false", " --bool=true", " --duration=24s",