From a8e44a8b5b1a75b1bfd95a46f809f9aba3ddb214 Mon Sep 17 00:00:00 2001 From: Zack Scholl Date: Thu, 17 Sep 2020 12:46:05 -0700 Subject: [PATCH 01/33] show only subcommand flags with bash completion --- help.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/help.go b/help.go index c1e974a481..95ba188945 100644 --- a/help.go +++ b/help.go @@ -164,9 +164,10 @@ func DefaultCompleteWithFlags(cmd *Command) func(c *Context) { if len(os.Args) > 2 { lastArg := os.Args[len(os.Args)-2] if strings.HasPrefix(lastArg, "-") { - printFlagSuggestions(lastArg, c.App.Flags, c.App.Writer) if cmd != nil { printFlagSuggestions(lastArg, cmd.Flags, c.App.Writer) + } else { + printFlagSuggestions(lastArg, c.App.Flags, c.App.Writer) } return } From 581b769cf3ee996b7277e895b30afa3f3e6921bf Mon Sep 17 00:00:00 2001 From: Derek Smith Date: Thu, 20 May 2021 20:04:51 -0500 Subject: [PATCH 02/33] feat(docs): add UsageText to docs output for markdown and man page generation (#1171) * feat(docs): add UsageText to docs output for markdown and man page generation * feat(docs): updated tests, DRYd up code, cleaned up string logic * fix(lint): fixed go1.15 lint errors --- docs.go | 48 ++++++++- docs_test.go | 148 ++++++++++++++++++++++++++++ testdata/expected-doc-full.man | 44 ++++++++- testdata/expected-doc-full.md | 26 +++++ testdata/expected-doc-no-authors.md | 26 +++++ testdata/expected-doc-no-flags.md | 26 +++++ testdata/expected-fish-full.fish | 9 +- 7 files changed, 320 insertions(+), 7 deletions(-) diff --git a/docs.go b/docs.go index 4c0e1f677c..021cc2b5b2 100644 --- a/docs.go +++ b/docs.go @@ -68,15 +68,16 @@ func prepareCommands(commands []*Command, level int) []string { if command.Hidden { continue } - usage := "" - if command.Usage != "" { - usage = command.Usage - } - prepared := fmt.Sprintf("%s %s\n\n%s\n", + usageText := prepareUsageText(command) + + usage := prepareUsage(command, usageText) + + prepared := fmt.Sprintf("%s %s\n\n%s%s", strings.Repeat("#", level+2), strings.Join(command.Names(), ", "), usage, + usageText, ) flags := prepareArgsWithValues(command.Flags) @@ -155,3 +156,40 @@ func flagDetails(flag DocGenerationFlag) string { } return ": " + description } + +func prepareUsageText(command *Command) string { + if command.UsageText == "" { + return "" + } + + // Remove leading and trailing newlines + preparedUsageText := strings.Trim(command.UsageText, "\n") + + var usageText string + if strings.Contains(preparedUsageText, "\n") { + // Format multi-line string as a code block using the 4 space schema to allow for embedded markdown such + // that it will not break the continuous code block. + for _, ln := range strings.Split(preparedUsageText, "\n") { + usageText += fmt.Sprintf(" %s\n", ln) + } + } else { + // Style a single line as a note + usageText = fmt.Sprintf(">%s\n", preparedUsageText) + } + + return usageText +} + +func prepareUsage(command *Command, usageText string) string { + if command.Usage == "" { + return "" + } + + usage := command.Usage + "\n" + // Add a newline to the Usage IFF there is a UsageText + if usageText != "" { + usage += "\n" + } + + return usage +} diff --git a/docs_test.go b/docs_test.go index fac106ff30..962c366640 100644 --- a/docs_test.go +++ b/docs_test.go @@ -67,6 +67,47 @@ func testApp() *App { }, { Name: "hidden-command", Hidden: true, + }, { + Aliases: []string{"u"}, + Flags: []Flag{ + &StringFlag{ + Name: "flag", + Aliases: []string{"fl", "f"}, + TakesFile: true, + }, + &BoolFlag{ + Name: "another-flag", + Aliases: []string{"b"}, + Usage: "another usage text", + }, + }, + Name: "usage", + Usage: "standard usage text", + UsageText: ` +Usage for the usage text +- formatted: Based on the specified ConfigMap and summon secrets.yml +- list: Inspect the environment for a specific process running on a Pod +- for_effect: Compare 'namespace' environment with 'local' + +` + "```" + ` +func() { ... } +` + "```" + ` + +Should be a part of the same code block +`, + Subcommands: []*Command{{ + Aliases: []string{"su"}, + Flags: []Flag{ + &BoolFlag{ + Name: "sub-command-flag", + Aliases: []string{"s"}, + Usage: "some usage text", + }, + }, + Name: "sub-usage", + Usage: "standard usage text", + UsageText: "Single line of UsageText", + }}, }} app.UsageText = "app [first_arg] [second_arg]" app.Usage = "Some app" @@ -175,3 +216,110 @@ func TestToManWithSection(t *testing.T) { expect(t, err, nil) expectFileContent(t, "testdata/expected-doc-full.man", res) } + +func Test_prepareUsageText(t *testing.T) { + t.Run("no UsageText provided", func(t *testing.T) { + // Given + cmd := Command{} + + // When + res := prepareUsageText(&cmd) + + // Then + expect(t, res, "") + }) + + t.Run("single line UsageText", func(t *testing.T) { + // Given + cmd := Command{UsageText: "Single line usage text"} + + // When + res := prepareUsageText(&cmd) + + // Then + expect(t, res, ">Single line usage text\n") + }) + + t.Run("multiline UsageText", func(t *testing.T) { + // Given + cmd := Command{ + UsageText: ` +Usage for the usage text +- Should be a part of the same code block +`, + } + + // When + res := prepareUsageText(&cmd) + + // Then + test := ` Usage for the usage text + - Should be a part of the same code block +` + expect(t, res, test) + }) + + t.Run("multiline UsageText has formatted embedded markdown", func(t *testing.T) { + // Given + cmd := Command{ + UsageText: ` +Usage for the usage text + +` + "```" + ` +func() { ... } +` + "```" + ` + +Should be a part of the same code block +`, + } + + // When + res := prepareUsageText(&cmd) + + // Then + test := ` Usage for the usage text + + ` + "```" + ` + func() { ... } + ` + "```" + ` + + Should be a part of the same code block +` + expect(t, res, test) + }) +} + +func Test_prepareUsage(t *testing.T) { + t.Run("no Usage provided", func(t *testing.T) { + // Given + cmd := Command{} + + // When + res := prepareUsage(&cmd, "") + + // Then + expect(t, res, "") + }) + + t.Run("simple Usage", func(t *testing.T) { + // Given + cmd := Command{Usage: "simple usage text"} + + // When + res := prepareUsage(&cmd, "") + + // Then + expect(t, res, cmd.Usage+"\n") + }) + + t.Run("simple Usage with UsageText", func(t *testing.T) { + // Given + cmd := Command{Usage: "simple usage text"} + + // When + res := prepareUsage(&cmd, "a non-empty string") + + // Then + expect(t, res, cmd.Usage+"\n\n") + }) +} diff --git a/testdata/expected-doc-full.man b/testdata/expected-doc-full.man index 2bea50731e..3ac35539cb 100644 --- a/testdata/expected-doc-full.man +++ b/testdata/expected-doc-full.man @@ -75,4 +75,46 @@ another usage test .PP retrieve generic information -.SH some\-command \ No newline at end of file +.SH some\-command +.SH usage, u +.PP +standard usage text + +.PP +.RS + +.nf +Usage for the usage text +\- formatted: Based on the specified ConfigMap and summon secrets.yml +\- list: Inspect the environment for a specific process running on a Pod +\- for\_effect: Compare 'namespace' environment with 'local' + +``` +func() { ... } +``` + +Should be a part of the same code block + +.fi +.RE + +.PP +\fB\-\-another\-flag, \-b\fP: another usage text + +.PP +\fB\-\-flag, \-\-fl, \-f\fP="": + +.SS sub\-usage, su +.PP +standard usage text + +.PP +.RS + +.PP +Single line of UsageText + +.RE + +.PP +\fB\-\-sub\-command\-flag, \-s\fP: some usage text diff --git a/testdata/expected-doc-full.md b/testdata/expected-doc-full.md index f272274061..7b8c0d7e9e 100644 --- a/testdata/expected-doc-full.md +++ b/testdata/expected-doc-full.md @@ -58,3 +58,29 @@ retrieve generic information ## some-command +## usage, u + +standard usage text + + Usage for the usage text + - formatted: Based on the specified ConfigMap and summon secrets.yml + - list: Inspect the environment for a specific process running on a Pod + - for_effect: Compare 'namespace' environment with 'local' + + ``` + func() { ... } + ``` + + Should be a part of the same code block + +**--another-flag, -b**: another usage text + +**--flag, --fl, -f**="": + +### sub-usage, su + +standard usage text + +>Single line of UsageText + +**--sub-command-flag, -s**: some usage text diff --git a/testdata/expected-doc-no-authors.md b/testdata/expected-doc-no-authors.md index f272274061..7b8c0d7e9e 100644 --- a/testdata/expected-doc-no-authors.md +++ b/testdata/expected-doc-no-authors.md @@ -58,3 +58,29 @@ retrieve generic information ## some-command +## usage, u + +standard usage text + + Usage for the usage text + - formatted: Based on the specified ConfigMap and summon secrets.yml + - list: Inspect the environment for a specific process running on a Pod + - for_effect: Compare 'namespace' environment with 'local' + + ``` + func() { ... } + ``` + + Should be a part of the same code block + +**--another-flag, -b**: another usage text + +**--flag, --fl, -f**="": + +### sub-usage, su + +standard usage text + +>Single line of UsageText + +**--sub-command-flag, -s**: some usage text diff --git a/testdata/expected-doc-no-flags.md b/testdata/expected-doc-no-flags.md index 2994593e8a..ebd0416ecd 100644 --- a/testdata/expected-doc-no-flags.md +++ b/testdata/expected-doc-no-flags.md @@ -43,3 +43,29 @@ retrieve generic information ## some-command +## usage, u + +standard usage text + + Usage for the usage text + - formatted: Based on the specified ConfigMap and summon secrets.yml + - list: Inspect the environment for a specific process running on a Pod + - for_effect: Compare 'namespace' environment with 'local' + + ``` + func() { ... } + ``` + + Should be a part of the same code block + +**--another-flag, -b**: another usage text + +**--flag, --fl, -f**="": + +### sub-usage, su + +standard usage text + +>Single line of UsageText + +**--sub-command-flag, -s**: some usage text diff --git a/testdata/expected-fish-full.fish b/testdata/expected-fish-full.fish index dc41e5aa9a..cc449c5f46 100644 --- a/testdata/expected-fish-full.fish +++ b/testdata/expected-fish-full.fish @@ -2,7 +2,7 @@ function __fish_greet_no_subcommand --description 'Test if there has been any subcommand yet' for i in (commandline -opc) - if contains -- $i config c sub-config s ss info i in some-command + if contains -- $i config c sub-config s ss info i in some-command usage u sub-usage su return 1 end end @@ -27,3 +27,10 @@ complete -c greet -n '__fish_seen_subcommand_from info i in' -f -l help -s h -d complete -r -c greet -n '__fish_greet_no_subcommand' -a 'info i in' -d 'retrieve generic information' complete -c greet -n '__fish_seen_subcommand_from some-command' -f -l help -s h -d 'show help' complete -r -c greet -n '__fish_greet_no_subcommand' -a 'some-command' +complete -c greet -n '__fish_seen_subcommand_from usage u' -f -l help -s h -d 'show help' +complete -r -c greet -n '__fish_greet_no_subcommand' -a 'usage u' -d 'standard usage text' +complete -c greet -n '__fish_seen_subcommand_from usage u' -l flag -s fl -s f -r +complete -c greet -n '__fish_seen_subcommand_from usage u' -f -l another-flag -s b -d 'another usage text' +complete -c greet -n '__fish_seen_subcommand_from sub-usage su' -f -l help -s h -d 'show help' +complete -r -c greet -n '__fish_seen_subcommand_from usage u' -a 'sub-usage su' -d 'standard usage text' +complete -c greet -n '__fish_seen_subcommand_from sub-usage su' -f -l sub-command-flag -s s -d 'some usage text' From 443c6a54a886a7d3aa79c70a046b4753c493626e Mon Sep 17 00:00:00 2001 From: Derek Smith Date: Thu, 3 Jun 2021 18:19:19 -0500 Subject: [PATCH 03/33] fix(UsageText): consistent indent for help UsageText output (#1279) Signed-off-by: Derek Smith --- help_test.go | 114 +++++++++++++++++++++++++++++++++++++++++++++++++++ template.go | 6 +-- 2 files changed, 117 insertions(+), 3 deletions(-) diff --git a/help_test.go b/help_test.go index 407c269173..8dd262d56c 100644 --- a/help_test.go +++ b/help_test.go @@ -511,6 +511,36 @@ func TestShowSubcommandHelp_CommandUsageText(t *testing.T) { } } +func TestShowSubcommandHelp_MultiLine_CommandUsageText(t *testing.T) { + app := &App{ + Commands: []*Command{ + { + Name: "frobbly", + UsageText: `This is a +multi +line +UsageText`, + }, + }, + } + + output := &bytes.Buffer{} + app.Writer = output + + _ = app.Run([]string{"foo", "frobbly", "--help"}) + + expected := `USAGE: + This is a + multi + line + UsageText +` + + if !strings.Contains(output.String(), expected) { + t.Errorf("expected output to include usage text; got: %q", output.String()) + } +} + func TestShowSubcommandHelp_SubcommandUsageText(t *testing.T) { app := &App{ Commands: []*Command{ @@ -535,6 +565,40 @@ func TestShowSubcommandHelp_SubcommandUsageText(t *testing.T) { } } +func TestShowSubcommandHelp_MultiLine_SubcommandUsageText(t *testing.T) { + app := &App{ + Commands: []*Command{ + { + Name: "frobbly", + Subcommands: []*Command{ + { + Name: "bobbly", + UsageText: `This is a +multi +line +UsageText`, + }, + }, + }, + }, + } + + output := &bytes.Buffer{} + app.Writer = output + _ = app.Run([]string{"foo", "frobbly", "bobbly", "--help"}) + + expected := `USAGE: + This is a + multi + line + UsageText +` + + if !strings.Contains(output.String(), expected) { + t.Errorf("expected output to include usage text; got: %q", output.String()) + } +} + func TestShowAppHelp_HiddenCommand(t *testing.T) { app := &App{ Commands: []*Command{ @@ -780,6 +844,56 @@ VERSION: } } +func TestShowAppHelp_UsageText(t *testing.T) { + app := &App{ + UsageText: "This is a sinlge line of UsageText", + Commands: []*Command{ + { + Name: "frobbly", + }, + }, + } + + output := &bytes.Buffer{} + app.Writer = output + + _ = app.Run([]string{"foo"}) + + if !strings.Contains(output.String(), "This is a sinlge line of UsageText") { + t.Errorf("expected output to include usage text; got: %q", output.String()) + } +} + +func TestShowAppHelp_MultiLine_UsageText(t *testing.T) { + app := &App{ + UsageText: `This is a +multi +line +App UsageText`, + Commands: []*Command{ + { + Name: "frobbly", + }, + }, + } + + output := &bytes.Buffer{} + app.Writer = output + + _ = app.Run([]string{"foo"}) + + expected := `USAGE: + This is a + multi + line + App UsageText +` + + if !strings.Contains(output.String(), expected) { + t.Errorf("expected output to include usage text; got: %q", output.String()) + } +} + func TestHideHelpCommand(t *testing.T) { app := &App{ HideHelpCommand: true, diff --git a/template.go b/template.go index 317cc8817d..69e040e7fb 100644 --- a/template.go +++ b/template.go @@ -7,7 +7,7 @@ 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}} + {{if .UsageText}}{{.UsageText | nindent 3 | trim}}{{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}} @@ -39,7 +39,7 @@ 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}} + {{if .UsageText}}{{.UsageText | nindent 3 | trim}}{{else}}{{.HelpName}}{{if .VisibleFlags}} [command options]{{end}} {{if .ArgsUsage}}{{.ArgsUsage}}{{else}}[arguments...]{{end}}{{end}}{{if .Category}} CATEGORY: {{.Category}}{{end}}{{if .Description}} @@ -59,7 +59,7 @@ var SubcommandHelpTemplate = `NAME: {{.HelpName}} - {{.Usage}} USAGE: - {{if .UsageText}}{{.UsageText}}{{else}}{{.HelpName}} command{{if .VisibleFlags}} [command options]{{end}} {{if .ArgsUsage}}{{.ArgsUsage}}{{else}}[arguments...]{{end}}{{end}}{{if .Description}} + {{if .UsageText}}{{.UsageText | nindent 3 | trim}}{{else}}{{.HelpName}} command{{if .VisibleFlags}} [command options]{{end}} {{if .ArgsUsage}}{{.ArgsUsage}}{{else}}[arguments...]{{end}}{{end}}{{if .Description}} DESCRIPTION: {{.Description | nindent 3 | trim}}{{end}} From b5d4a04c7fb1c7de98d491ee5af9130006fe06c6 Mon Sep 17 00:00:00 2001 From: Ashwani Date: Sun, 13 Jun 2021 19:06:57 +0530 Subject: [PATCH 04/33] Resolved a grammatical error (#1281) --- funcs.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/funcs.go b/funcs.go index 474c48faf9..842b4aa99c 100644 --- a/funcs.go +++ b/funcs.go @@ -17,7 +17,7 @@ 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 +// OnUsageErrorFunc is executed if a 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. From 6373f5bf650c1be406c1de1e946f45ddecc34977 Mon Sep 17 00:00:00 2001 From: Link Dupont Date: Tue, 6 Jul 2021 20:20:47 -0400 Subject: [PATCH 05/33] feat(docs): Include Description and UsageText in docs output (#1287) Include Description as part of the DESCRIPTION section, and put UsageText (if it is non-zero) into the Usage subsection. --- docs_test.go | 14 +++++ template.go | 10 ++-- testdata/expected-doc-full.man | 4 +- testdata/expected-doc-full.md | 4 +- testdata/expected-doc-no-authors.md | 4 +- testdata/expected-doc-no-commands.md | 4 +- testdata/expected-doc-no-flags.md | 4 +- testdata/expected-doc-no-usagetext.md | 86 +++++++++++++++++++++++++++ 8 files changed, 116 insertions(+), 14 deletions(-) create mode 100644 testdata/expected-doc-no-usagetext.md diff --git a/docs_test.go b/docs_test.go index 962c366640..5308f372f7 100644 --- a/docs_test.go +++ b/docs_test.go @@ -110,6 +110,7 @@ Should be a part of the same code block }}, }} app.UsageText = "app [first_arg] [second_arg]" + app.Description = `Description of the application.` app.Usage = "Some app" app.Authors = []*Author{ {Name: "Harrison", Email: "harrison@lolwut.com"}, @@ -178,6 +179,19 @@ func TestToMarkdownNoAuthors(t *testing.T) { expectFileContent(t, "testdata/expected-doc-no-authors.md", res) } +func TestToMarkdownNoUsageText(t *testing.T) { + // Given + app := testApp() + app.UsageText = "" + + // When + res, err := app.ToMarkdown() + + // Then + expect(t, err, nil) + expectFileContent(t, "testdata/expected-doc-no-usagetext.md", res) +} + func TestToMan(t *testing.T) { // Given app := testApp() diff --git a/template.go b/template.go index 69e040e7fb..708a402813 100644 --- a/template.go +++ b/template.go @@ -86,16 +86,18 @@ var MarkdownDocTemplate = `% {{ .App.Name }} {{ .SectionNum }} {{ if .SynopsisArgs }} ` + "```" + ` {{ range $v := .SynopsisArgs }}{{ $v }}{{ end }}` + "```" + ` -{{ end }}{{ if .App.UsageText }} +{{ end }}{{ if .App.Description }} # DESCRIPTION -{{ .App.UsageText }} +{{ .App.Description }} {{ end }} **Usage**: -` + "```" + ` +` + "```" + `{{ if .App.UsageText }} +{{ .App.UsageText }} +{{ else }} {{ .App.Name }} [GLOBAL OPTIONS] command [COMMAND OPTIONS] [ARGUMENTS...] -` + "```" + ` +{{ end }}` + "```" + ` {{ if .GlobalArgs }} # GLOBAL OPTIONS {{ range $v := .GlobalArgs }} diff --git a/testdata/expected-doc-full.man b/testdata/expected-doc-full.man index 3ac35539cb..3df4684a2d 100644 --- a/testdata/expected-doc-full.man +++ b/testdata/expected-doc-full.man @@ -24,7 +24,7 @@ greet .SH DESCRIPTION .PP -app [first\_arg] [second\_arg] +Description of the application. .PP \fBUsage\fP: @@ -33,7 +33,7 @@ app [first\_arg] [second\_arg] .RS .nf -greet [GLOBAL OPTIONS] command [COMMAND OPTIONS] [ARGUMENTS...] +app [first\_arg] [second\_arg] .fi .RE diff --git a/testdata/expected-doc-full.md b/testdata/expected-doc-full.md index 7b8c0d7e9e..f3374e5b1c 100644 --- a/testdata/expected-doc-full.md +++ b/testdata/expected-doc-full.md @@ -16,12 +16,12 @@ greet # DESCRIPTION -app [first_arg] [second_arg] +Description of the application. **Usage**: ``` -greet [GLOBAL OPTIONS] command [COMMAND OPTIONS] [ARGUMENTS...] +app [first_arg] [second_arg] ``` # GLOBAL OPTIONS diff --git a/testdata/expected-doc-no-authors.md b/testdata/expected-doc-no-authors.md index 7b8c0d7e9e..f3374e5b1c 100644 --- a/testdata/expected-doc-no-authors.md +++ b/testdata/expected-doc-no-authors.md @@ -16,12 +16,12 @@ greet # DESCRIPTION -app [first_arg] [second_arg] +Description of the application. **Usage**: ``` -greet [GLOBAL OPTIONS] command [COMMAND OPTIONS] [ARGUMENTS...] +app [first_arg] [second_arg] ``` # GLOBAL OPTIONS diff --git a/testdata/expected-doc-no-commands.md b/testdata/expected-doc-no-commands.md index adaedb43e0..1c4fd075ed 100644 --- a/testdata/expected-doc-no-commands.md +++ b/testdata/expected-doc-no-commands.md @@ -16,12 +16,12 @@ greet # DESCRIPTION -app [first_arg] [second_arg] +Description of the application. **Usage**: ``` -greet [GLOBAL OPTIONS] command [COMMAND OPTIONS] [ARGUMENTS...] +app [first_arg] [second_arg] ``` # GLOBAL OPTIONS diff --git a/testdata/expected-doc-no-flags.md b/testdata/expected-doc-no-flags.md index ebd0416ecd..cf766ad9ca 100644 --- a/testdata/expected-doc-no-flags.md +++ b/testdata/expected-doc-no-flags.md @@ -10,12 +10,12 @@ greet # DESCRIPTION -app [first_arg] [second_arg] +Description of the application. **Usage**: ``` -greet [GLOBAL OPTIONS] command [COMMAND OPTIONS] [ARGUMENTS...] +app [first_arg] [second_arg] ``` # COMMANDS diff --git a/testdata/expected-doc-no-usagetext.md b/testdata/expected-doc-no-usagetext.md new file mode 100644 index 0000000000..da31b38ef1 --- /dev/null +++ b/testdata/expected-doc-no-usagetext.md @@ -0,0 +1,86 @@ +% greet 8 + +# NAME + +greet - Some app + +# SYNOPSIS + +greet + +``` +[--another-flag|-b] +[--flag|--fl|-f]=[value] +[--socket|-s]=[value] +``` + +# DESCRIPTION + +Description of the application. + +**Usage**: + +``` +greet [GLOBAL OPTIONS] command [COMMAND OPTIONS] [ARGUMENTS...] +``` + +# GLOBAL OPTIONS + +**--another-flag, -b**: another usage text + +**--flag, --fl, -f**="": + +**--socket, -s**="": some 'usage' text (default: value) + + +# COMMANDS + +## config, c + +another usage test + +**--another-flag, -b**: another usage text + +**--flag, --fl, -f**="": + +### sub-config, s, ss + +another usage test + +**--sub-command-flag, -s**: some usage text + +**--sub-flag, --sub-fl, -s**="": + +## info, i, in + +retrieve generic information + +## some-command + + +## usage, u + +standard usage text + + Usage for the usage text + - formatted: Based on the specified ConfigMap and summon secrets.yml + - list: Inspect the environment for a specific process running on a Pod + - for_effect: Compare 'namespace' environment with 'local' + + ``` + func() { ... } + ``` + + Should be a part of the same code block + +**--another-flag, -b**: another usage text + +**--flag, --fl, -f**="": + +### sub-usage, su + +standard usage text + +>Single line of UsageText + +**--sub-command-flag, -s**: some usage text From 58d113dd731e7ab9520fed165b581b8a50663f66 Mon Sep 17 00:00:00 2001 From: Ally Dale Date: Wed, 7 Jul 2021 08:33:01 +0800 Subject: [PATCH 06/33] fix #1239: slice flag value don't append to default values from ENV or file (#1240) * fix #1239: slice flag value don't append to default values from ENV or file * remove test code --- flag_float64_slice.go | 3 +++ flag_int64_slice.go | 3 +++ flag_int_slice.go | 3 +++ flag_test.go | 13 +++++++++++-- 4 files changed, 20 insertions(+), 2 deletions(-) diff --git a/flag_float64_slice.go b/flag_float64_slice.go index f752ad7534..385732e17c 100644 --- a/flag_float64_slice.go +++ b/flag_float64_slice.go @@ -144,6 +144,9 @@ func (f *Float64SliceFlag) Apply(set *flag.FlagSet) error { } } + // Set this to false so that we reset the slice if we then set values from + // flags that have already been set by the environment. + f.Value.hasBeenSet = false f.HasBeenSet = true } } diff --git a/flag_int64_slice.go b/flag_int64_slice.go index b4c8bc1496..f5c6939639 100644 --- a/flag_int64_slice.go +++ b/flag_int64_slice.go @@ -144,6 +144,9 @@ func (f *Int64SliceFlag) Apply(set *flag.FlagSet) error { } } + // Set this to false so that we reset the slice if we then set values from + // flags that have already been set by the environment. + f.Value.hasBeenSet = false f.HasBeenSet = true } diff --git a/flag_int_slice.go b/flag_int_slice.go index d4889b382c..94c668e9f1 100644 --- a/flag_int_slice.go +++ b/flag_int_slice.go @@ -155,6 +155,9 @@ func (f *IntSliceFlag) Apply(set *flag.FlagSet) error { } } + // Set this to false so that we reset the slice if we then set values from + // flags that have already been set by the environment. + f.Value.hasBeenSet = false f.HasBeenSet = true } diff --git a/flag_test.go b/flag_test.go index e46270d034..c563d6f346 100644 --- a/flag_test.go +++ b/flag_test.go @@ -52,15 +52,21 @@ func TestBoolFlagApply_SetsAllNames(t *testing.T) { } func TestFlagsFromEnv(t *testing.T) { + newSetFloat64Slice := func(defaults ...float64) Float64Slice { + s := NewFloat64Slice(defaults...) + s.hasBeenSet = false + return *s + } + newSetIntSlice := func(defaults ...int) IntSlice { s := NewIntSlice(defaults...) - s.hasBeenSet = true + s.hasBeenSet = false return *s } newSetInt64Slice := func(defaults ...int64) Int64Slice { s := NewInt64Slice(defaults...) - s.hasBeenSet = true + s.hasBeenSet = false return *s } @@ -96,6 +102,9 @@ func TestFlagsFromEnv(t *testing.T) { {"1.2", 0, &IntFlag{Name: "seconds", EnvVars: []string{"SECONDS"}}, `could not parse "1.2" as int value for flag seconds: .*`}, {"foobar", 0, &IntFlag{Name: "seconds", EnvVars: []string{"SECONDS"}}, `could not parse "foobar" as int value for flag seconds: .*`}, + {"1.0,2", newSetFloat64Slice(1, 2), &Float64SliceFlag{Name: "seconds", EnvVars: []string{"SECONDS"}}, ""}, + {"foobar", newSetFloat64Slice(), &Float64SliceFlag{Name: "seconds", EnvVars: []string{"SECONDS"}}, `could not parse "\[\]float64{}" as float64 slice value for flag seconds: .*`}, + {"1,2", newSetIntSlice(1, 2), &IntSliceFlag{Name: "seconds", EnvVars: []string{"SECONDS"}}, ""}, {"1.2,2", newSetIntSlice(), &IntSliceFlag{Name: "seconds", EnvVars: []string{"SECONDS"}}, `could not parse "1.2,2" as int slice value for flag seconds: .*`}, {"foobar", newSetIntSlice(), &IntSliceFlag{Name: "seconds", EnvVars: []string{"SECONDS"}}, `could not parse "foobar" as int slice value for flag seconds: .*`}, From 67d7f9403dee81f1d2629f3079b4274ccfb9c41d Mon Sep 17 00:00:00 2001 From: Robert Liebowitz Date: Thu, 9 Sep 2021 05:31:46 -0400 Subject: [PATCH 07/33] Remove stalebot (#1300) --- .github/stale.yml | 64 ----------------------------------------------- 1 file changed, 64 deletions(-) delete mode 100644 .github/stale.yml diff --git a/.github/stale.yml b/.github/stale.yml deleted file mode 100644 index 0cc30077be..0000000000 --- a/.github/stale.yml +++ /dev/null @@ -1,64 +0,0 @@ -# Configuration for probot-stale - https://github.com/probot/stale - -# Number of days of inactivity before an Issue or Pull Request becomes stale -daysUntilStale: 90 - -# Number of days of inactivity before an Issue or Pull Request with the stale label is closed. -# Set to false to disable. If disabled, issues still need to be closed manually, but will remain marked as stale. -daysUntilClose: 30 - -# Only issues or pull requests with all of these labels are check if stale. Defaults to `[]` (disabled) -onlyLabels: [] - -# Issues or Pull Requests with these labels will never be considered stale. Set to `[]` to disable -exemptLabels: - - pinned - - security - - "help wanted" - - "kind/maintenance" - -# Set to true to ignore issues in a project (defaults to false) -exemptProjects: false - -# Set to true to ignore issues in a milestone (defaults to false) -exemptMilestones: false - -# Set to true to ignore issues with an assignee (defaults to false) -exemptAssignees: false - -# Label to use when marking as stale -staleLabel: "status/stale" - -# Comment to post when marking as stale. Set to `false` to disable -markComment: > - This issue or PR has been automatically marked as stale because it has not had - recent activity. Please add a comment bumping this if you're still - interested in it's resolution! Thanks for your help, please let us know - if you need anything else. - -# Comment to post when removing the stale label. -unmarkComment: > - This issue or PR has been bumped and is no longer marked as stale! Feel free - to bump it again in the future, if it's still relevant. - -# Comment to post when closing a stale Issue or Pull Request. -closeComment: > - Closing this as it has become stale. - -# Limit the number of actions per hour, from 1-30. Default is 30 -limitPerRun: 30 - -# Limit to only `issues` or `pulls` -# only: issues - -# Optionally, specify configuration settings that are specific to just 'issues' or 'pulls': -# pulls: -# daysUntilStale: 30 -# markComment: > -# This pull request has been automatically marked as stale because it has not had -# recent activity. It will be closed if no further activity occurs. Thank you -# for your contributions. - -# issues: -# exemptLabels: -# - confirmed From 1259f1efc973b210de2c7b448b6302d6f52081d1 Mon Sep 17 00:00:00 2001 From: JayCeeJr <1265665+JayCeeJr@users.noreply.github.com> Date: Wed, 15 Sep 2021 22:16:31 -0500 Subject: [PATCH 08/33] Unnecessary words (#1304) It is unclear what `as the default` means. Much more concise to remove it. --- docs/v2/manual.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/v2/manual.md b/docs/v2/manual.md index af09010b9a..56be65bb68 100644 --- a/docs/v2/manual.md +++ b/docs/v2/manual.md @@ -514,7 +514,7 @@ func main() { ``` If `EnvVars` contains more than one string, the first environment variable that -resolves is used as the default. +resolves is used. @@ -53,7 +56,7 @@ Check each file for this and make the change. Shell command to find them all: `fgrep -rl github.com/urfave/cli *` -# Flag aliases are done differently. +# Flag aliases are done differently Change `Name: "foo, f"` to `Name: "foo", Aliases: []string{"f"}` From 12b9c9d42002b6ad33e8572430ab446448c117fb Mon Sep 17 00:00:00 2001 From: Dan Buch Date: Tue, 19 Apr 2022 16:32:23 -0400 Subject: [PATCH 22/33] Bump matrix of supported Go versions to test on the latest release (^1.18) and drop testing/supporting ^1.15. --- .github/workflows/cli.yml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/.github/workflows/cli.yml b/.github/workflows/cli.yml index e3b7a9773a..2752ec2a20 100644 --- a/.github/workflows/cli.yml +++ b/.github/workflows/cli.yml @@ -15,7 +15,7 @@ jobs: strategy: matrix: os: [ubuntu-latest, macos-latest, windows-latest] - go: [1.15, 1.16, 1.17] + go: [^1.16, ^1.17, ^1.18] name: ${{ matrix.os }} @ Go ${{ matrix.go }} runs-on: ${{ matrix.os }} steps: @@ -38,7 +38,7 @@ jobs: ref: ${{ github.ref }} - name: GOFMT Check - if: matrix.go == 1.17 && matrix.os == 'ubuntu-latest' + if: matrix.go == '^1.17' && matrix.os == 'ubuntu-latest' run: test -z $(gofmt -l .) - name: vet @@ -51,7 +51,7 @@ jobs: run: go run internal/build/build.go check-binary-size - name: Upload coverage to Codecov - if: success() && matrix.go == 1.17 && matrix.os == 'ubuntu-latest' + if: success() && matrix.go == '^1.17' && matrix.os == 'ubuntu-latest' uses: codecov/codecov-action@v1 with: fail_ci_if_error: true @@ -63,8 +63,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v1 with: - # Currently fails on 1.16+ - go-version: 1.15 + go-version: ^1.18 - name: Use Node.js 12.x uses: actions/setup-node@v1 From e61b99e19a022a8db3ac0538518c781676f06362 Mon Sep 17 00:00:00 2001 From: Dan Buch Date: Tue, 19 Apr 2022 16:51:13 -0400 Subject: [PATCH 23/33] Add Stale bot configuration per docs with (greatly) extended values for `daysUntilStale` and `daysUntilClose` per suggestion. --- .github/stale.yml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 .github/stale.yml diff --git a/.github/stale.yml b/.github/stale.yml new file mode 100644 index 0000000000..f050e9b7ae --- /dev/null +++ b/.github/stale.yml @@ -0,0 +1,17 @@ +# Number of days of inactivity before an issue becomes stale +daysUntilStale: 365 +# Number of days of inactivity before a stale issue is closed +daysUntilClose: 90 +# Issues with these labels will never be considered stale +exemptLabels: + - pinned + - security +# Label to use when marking an issue as stale +staleLabel: wontfix +# Comment to post when marking an issue as stale. Set to `false` to disable +markComment: > + This issue has been automatically marked as stale because it has not had + recent activity. It will be closed if no further activity occurs. Thank you + for your contributions. +# Comment to post when closing a stale issue. Set to `false` to disable +closeComment: false From d7bc33018bd2b0f391def3e9c31293d835747663 Mon Sep 17 00:00:00 2001 From: Dan Buch Date: Tue, 19 Apr 2022 16:57:25 -0400 Subject: [PATCH 24/33] Drop references/usage of GO111MODULE --- .github/workflows/cli.yml | 2 -- README.md | 4 ++-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/cli.yml b/.github/workflows/cli.yml index e3b7a9773a..e80305856d 100644 --- a/.github/workflows/cli.yml +++ b/.github/workflows/cli.yml @@ -27,7 +27,6 @@ jobs: - name: Set GOPATH, PATH and ENV run: | echo "GOPATH=$(dirname $GITHUB_WORKSPACE)" >> $GITHUB_ENV - echo "GO111MODULE=on" >> $GITHUB_ENV echo "GOPROXY=https://proxy.golang.org" >> $GITHUB_ENV echo "$(dirname $GITHUB_WORKSPACE)/bin" >> $GITHUB_PATH shell: bash @@ -74,7 +73,6 @@ jobs: - name: Set GOPATH, PATH and ENV run: | echo "GOPATH=$(dirname $GITHUB_WORKSPACE)" >> $GITHUB_ENV - echo "GO111MODULE=on" >> $GITHUB_ENV echo "GOPROXY=https://proxy.golang.org" >> $GITHUB_ENV echo "$(dirname $GITHUB_WORKSPACE)/bin" >> $GITHUB_PATH shell: bash diff --git a/README.md b/README.md index 2b74f1f2c9..eab737192a 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ Go Modules are required when using this package. [See the go blog guide on using ### Using `v2` releases ``` -$ GO111MODULE=on go get github.com/urfave/cli/v2 +$ go get github.com/urfave/cli/v2 ``` ```go @@ -44,7 +44,7 @@ import ( ### Using `v1` releases ``` -$ GO111MODULE=on go get github.com/urfave/cli +$ go get github.com/urfave/cli ``` ```go From 17aa508d22ae7997bc9b650556f27caa0f24265c Mon Sep 17 00:00:00 2001 From: Dan Buch Date: Wed, 20 Apr 2022 14:38:32 -0400 Subject: [PATCH 25/33] Switch to gfmrun v1.3.0 --- .github/workflows/cli.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/cli.yml b/.github/workflows/cli.yml index 2752ec2a20..8edeb914bf 100644 --- a/.github/workflows/cli.yml +++ b/.github/workflows/cli.yml @@ -29,7 +29,7 @@ jobs: echo "GOPATH=$(dirname $GITHUB_WORKSPACE)" >> $GITHUB_ENV echo "GO111MODULE=on" >> $GITHUB_ENV echo "GOPROXY=https://proxy.golang.org" >> $GITHUB_ENV - echo "$(dirname $GITHUB_WORKSPACE)/bin" >> $GITHUB_PATH + echo "${GITHUB_WORKSPACE}/.local/bin" >> $GITHUB_PATH shell: bash - name: Checkout Code @@ -75,7 +75,7 @@ jobs: echo "GOPATH=$(dirname $GITHUB_WORKSPACE)" >> $GITHUB_ENV echo "GO111MODULE=on" >> $GITHUB_ENV echo "GOPROXY=https://proxy.golang.org" >> $GITHUB_ENV - echo "$(dirname $GITHUB_WORKSPACE)/bin" >> $GITHUB_PATH + echo "${GITHUB_WORKSPACE}/.local/bin" >> $GITHUB_PATH shell: bash - name: Checkout Code @@ -85,9 +85,9 @@ jobs: - name: Install Dependencies run: | - mkdir -p $GOPATH/bin - curl -L -o $GOPATH/bin/gfmrun "https://github.com/urfave/gfmrun/releases/download/v1.2.14/gfmrun-$(go env GOOS)-amd64-v1.2.14" - chmod +x $GOPATH/bin/gfmrun + mkdir -p "${GITHUB_WORKSPACE}/.local/bin" && \ + curl -fsSL -o "${GITHUB_WORKSPACE}/.local/bin/gfmrun" "https://github.com/urfave/gfmrun/releases/download/v1.3.0/gfmrun-$(go env GOOS)-$(go env goarch)-v1.3.0" && \ + chmod +x "${GITHUB_WORKSPACE}/.local/bin/gfmrun" && \ npm install -g markdown-toc@1.2.0 - name: Run Tests (v1) From 8c33a078d1fd99ad15144ff275f4cc767301b806 Mon Sep 17 00:00:00 2001 From: Dan Buch Date: Wed, 20 Apr 2022 14:41:26 -0400 Subject: [PATCH 26/33] Use `go env` correctly --- .github/workflows/cli.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cli.yml b/.github/workflows/cli.yml index 8edeb914bf..480a4a0368 100644 --- a/.github/workflows/cli.yml +++ b/.github/workflows/cli.yml @@ -86,7 +86,7 @@ jobs: - name: Install Dependencies run: | mkdir -p "${GITHUB_WORKSPACE}/.local/bin" && \ - curl -fsSL -o "${GITHUB_WORKSPACE}/.local/bin/gfmrun" "https://github.com/urfave/gfmrun/releases/download/v1.3.0/gfmrun-$(go env GOOS)-$(go env goarch)-v1.3.0" && \ + curl -fsSL -o "${GITHUB_WORKSPACE}/.local/bin/gfmrun" "https://github.com/urfave/gfmrun/releases/download/v1.3.0/gfmrun-$(go env GOOS)-$(go env GOARCH)-v1.3.0" && \ chmod +x "${GITHUB_WORKSPACE}/.local/bin/gfmrun" && \ npm install -g markdown-toc@1.2.0 From 5c6ccfb097f10c64582ed943d52d9cac21dd5106 Mon Sep 17 00:00:00 2001 From: Dan Buch Date: Wed, 20 Apr 2022 14:45:04 -0400 Subject: [PATCH 27/33] Add missing `"fmt"` import in example --- .gitignore | 1 + docs/v2/manual.md | 2 ++ 2 files changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index afdca418ca..e0c50aba49 100644 --- a/.gitignore +++ b/.gitignore @@ -5,5 +5,6 @@ vendor .idea internal/*/built-example coverage.txt +/.local/ *.exe diff --git a/docs/v2/manual.md b/docs/v2/manual.md index 56be65bb68..b480dd685f 100644 --- a/docs/v2/manual.md +++ b/docs/v2/manual.md @@ -674,8 +674,10 @@ Take for example this app that requires the `lang` flag: package main import ( + "fmt" "log" "os" + "github.com/urfave/cli/v2" ) From e63054a42e87bc5710b8911d8650f33f8cde2027 Mon Sep 17 00:00:00 2001 From: Dan Buch Date: Thu, 21 Apr 2022 15:07:45 -0400 Subject: [PATCH 28/33] Attempting to soften the barrier to entry and also removing issue title formatting that overlaps with label functionality --- .github/ISSUE_TEMPLATE/question.md | 8 ++-- .github/ISSUE_TEMPLATE/v1-bug-report.md | 39 +++++++++++++------- .github/ISSUE_TEMPLATE/v2-bug-report.md | 39 +++++++++++++------- .github/ISSUE_TEMPLATE/v2-feature-request.md | 16 +++++--- .github/pull_request_template.md | 13 +++++-- 5 files changed, 72 insertions(+), 43 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/question.md b/.github/ISSUE_TEMPLATE/question.md index bca4fea10d..b9680757c2 100644 --- a/.github/ISSUE_TEMPLATE/question.md +++ b/.github/ISSUE_TEMPLATE/question.md @@ -1,12 +1,10 @@ --- name: ask a question -about: ask us question - assume stackoverflow's guidelines apply here -title: 'q: ( your question title goes here )' +about: ask a question - assume stackoverflow's guidelines apply here +title: your question title goes here labels: 'kind/question, status/triage, area/v2' assignees: '' --- -## my question is... - -_**( Put the question text here )**_ +my question is... diff --git a/.github/ISSUE_TEMPLATE/v1-bug-report.md b/.github/ISSUE_TEMPLATE/v1-bug-report.md index aabfe820a6..b37f40e590 100644 --- a/.github/ISSUE_TEMPLATE/v1-bug-report.md +++ b/.github/ISSUE_TEMPLATE/v1-bug-report.md @@ -1,28 +1,32 @@ --- name: v1 bug report about: Create a report to help us fix v1 bugs -title: 'v1 bug: ( your bug title goes here )' +title: 'your bug title goes here' labels: 'kind/bug, status/triage, area/v1' assignees: '' --- -## my urfave/cli version is +## My urfave/cli version is _**( Put the version of urfave/cli that you are using here )**_ ## Checklist -* [ ] Are you running the latest v1 release? The list of releases is [here](https://github.com/urfave/cli/releases). -* [ ] Did you check the manual for your release? The v1 manual is [here](https://github.com/urfave/cli/blob/master/docs/v1/manual.md) -* [ ] Did you perform a search about this problem? Here's the [Github guide](https://help.github.com/en/github/managing-your-work-on-github/using-search-to-filter-issues-and-pull-requests) about searching. +- [ ] Are you running the latest v1 release? The list of releases is [here](https://github.com/urfave/cli/releases). +- [ ] Did you check the manual for your release? The v1 manual is [here](https://github.com/urfave/cli/blob/master/docs/v1/manual.md). +- [ ] Did you perform a search about this problem? Here's the [Github guide](https://help.github.com/en/github/managing-your-work-on-github/using-search-to-filter-issues-and-pull-requests) about searching. ## Dependency Management -- [ ] My project is using go modules. -- [ ] My project is using vendoring. -- [ ] My project is automatically downloading the latest version. -- [ ] I am unsure of what my dependency management setup is. + + +- My project is using go modules. +- My project is using vendoring. +- My project is automatically downloading the latest version. +- I am unsure of what my dependency management setup is. ## Describe the bug @@ -34,23 +38,30 @@ Describe the steps or code required to reproduce the behavior ## Observed behavior -What did you see happen immediately after the reproduction steps above? +What did you see happen immediately after the reproduction steps +above? ## Expected behavior -What would you have expected to happen immediately after the reproduction steps above? +What would you have expected to happen immediately after the +reproduction steps above? ## Additional context Add any other context about the problem here. -If the issue relates to a specific open source Github repo, please link that repo here. +If the issue relates to a specific open source Github repo, please +link that repo here. -If you can reproduce this issue with a public CI system, please link a failing build here. +If you can reproduce this issue with a public CI system, please +link a failing build here. ## Want to fix this yourself? -We'd love to have more contributors on this project! If the fix for this bug is easily explained and very small, free free to create a pull request for it. You'll want to base the PR off the `v1` branch, all `v1` bug fix releases will be made from that branch. +We'd love to have more contributors on this project! If the fix for +this bug is easily explained and very small, free free to create a +pull request for it. You'll want to base the PR off the `v1` +branch, all `v1` bug fix releases will be made from that branch. ## Run `go version` and paste its output here diff --git a/.github/ISSUE_TEMPLATE/v2-bug-report.md b/.github/ISSUE_TEMPLATE/v2-bug-report.md index 9944769b3e..6561ebf9ca 100644 --- a/.github/ISSUE_TEMPLATE/v2-bug-report.md +++ b/.github/ISSUE_TEMPLATE/v2-bug-report.md @@ -1,28 +1,32 @@ --- name: v2 bug report about: Create a report to help us fix v2 bugs -title: 'v2 bug: ( your bug title goes here )' +title: 'your bug title goes here' labels: 'kind/bug, area/v2, status/triage' assignees: '' --- -## my urfave/cli version is +## My urfave/cli version is _**( Put the version of urfave/cli that you are using here )**_ ## Checklist -* [ ] Are you running the latest v2 release? The list of releases is [here](https://github.com/urfave/cli/releases). -* [ ] Did you check the manual for your release? The v2 manual is [here](https://github.com/urfave/cli/blob/master/docs/v2/manual.md) -* [ ] Did you perform a search about this problem? Here's the [Github guide](https://help.github.com/en/github/managing-your-work-on-github/using-search-to-filter-issues-and-pull-requests) about searching. +- [ ] Are you running the latest v2 release? The list of releases is [here](https://github.com/urfave/cli/releases). +- [ ] Did you check the manual for your release? The v2 manual is [here](https://github.com/urfave/cli/blob/master/docs/v2/manual.md) +- [ ] Did you perform a search about this problem? Here's the [Github guide](https://help.github.com/en/github/managing-your-work-on-github/using-search-to-filter-issues-and-pull-requests) about searching. ## Dependency Management -- [ ] My project is using go modules. -- [ ] My project is using vendoring. -- [ ] My project is automatically downloading the latest version. -- [ ] I am unsure of what my dependency management setup is. + + +- My project is using go modules. +- My project is using vendoring. +- My project is automatically downloading the latest version. +- I am unsure of what my dependency management setup is. ## Describe the bug @@ -34,23 +38,30 @@ Describe the steps or code required to reproduce the behavior ## Observed behavior -What did you see happen immediately after the reproduction steps above? +What did you see happen immediately after the reproduction steps +above? ## Expected behavior -What would you have expected to happen immediately after the reproduction steps above? +What would you have expected to happen immediately after the +reproduction steps above? ## Additional context Add any other context about the problem here. -If the issue relates to a specific open source Github repo, please link that repo here. +If the issue relates to a specific open source Github repo, please +link that repo here. -If you can reproduce this issue with a public CI system, please link a failing build here. +If you can reproduce this issue with a public CI system, please +link a failing build here. ## Want to fix this yourself? -We'd love to have more contributors on this project! If the fix for this bug is easily explained and very small, free free to create a pull request for it. +We'd love to have more contributors on this project! If the fix for +this bug is easily explained and very small, free free to create a +pull request for it. + ## Run `go version` and paste its output here ``` diff --git a/.github/ISSUE_TEMPLATE/v2-feature-request.md b/.github/ISSUE_TEMPLATE/v2-feature-request.md index bc527b1c6e..e830446926 100644 --- a/.github/ISSUE_TEMPLATE/v2-feature-request.md +++ b/.github/ISSUE_TEMPLATE/v2-feature-request.md @@ -1,7 +1,7 @@ --- name: v2 feature request about: Suggest an improvement for v2 -title: 'v2 feature: ( your feature title goes here )' +title: 'your feature title goes here' labels: 'type/feature, area/v2, status/triage' assignees: '' @@ -10,16 +10,19 @@ assignees: '' ## Checklist * [ ] Are you running the latest v2 release? The list of releases is [here](https://github.com/urfave/cli/releases). -* [ ] Did you check the manual for your release? The v2 manual is [here](https://github.com/urfave/cli/blob/master/docs/v2/manual.md) +* [ ] Did you check the manual for your release? The v2 manual is [here](https://github.com/urfave/cli/blob/master/docs/v2/manual.md). * [ ] Did you perform a search about this feature? Here's the [Github guide](https://help.github.com/en/github/managing-your-work-on-github/using-search-to-filter-issues-and-pull-requests) about searching. ## What problem does this solve? A clear and concise description of what problem this feature would solve. For example: -- needing to type out the full flag name takes a long time, so I would like to suggest adding auto-complete -- I use (osx, windows, linux) and would like support for (some existing feature) to be extended to my platform -- the terminal output for a particular error case is confusing, and I think it could be improved +- needing to type out the full flag name takes a long time, so I + would like to suggest adding auto-complete +- I use (osx, windows, linux) and would like support for (some + existing feature) to be extended to my platform +- the terminal output for a particular error case is confusing, and + I think it could be improved ## Solution description @@ -27,4 +30,5 @@ A detailed description of what you want to happen. ## Describe alternatives you've considered -A clear and concise description of any alternative solutions or features you've considered. +A clear and concise description of any alternative solutions or +features you've considered. diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 4e76725765..47348f85ca 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -8,10 +8,14 @@ _(REQUIRED)_ -- [ ] bug -- [ ] cleanup -- [ ] documentation -- [ ] feature + + +- bug +- cleanup +- documentation +- feature ## What this PR does / why we need it: @@ -28,6 +32,7 @@ _(REQUIRED)_ ## Which issue(s) this PR fixes: _(REQUIRED)_ +