cli icon indicating copy to clipboard operation
cli copied to clipboard

include a newline between different categories

Open abennett opened this issue 2 years ago • 3 comments

What type of PR is this?

  • bug

What this PR does / why we need it:

The docs show a newline between categories in the default help output. This change adds the newline and makes the actual output consistent with documentation.

Which issue(s) this PR fixes:

N/A

Special notes for your reviewer:

Appreciate your work!

Testing

Using the example:

package main

import (
	"context"
	"log"
	"os"

	"github.com/urfave/cli/v3"
)

func main() {
	app := &cli.Command{
		Commands: []*cli.Command{
			{
				Name: "noop",
			},
			{
				Name:     "add",
				Category: "template",
			},
			{
				Name:     "remove",
				Category: "template",
			},
		},
	}

	if err := app.Run(context.Background(), os.Args); err != nil {
		log.Fatal(err)
	}
}

Diff:

diff --git a/before b/after
index b89e493..498ee0e 100644
--- a/before
+++ b/after
@@ -7,6 +7,7 @@ USAGE:
 COMMANDS:
    noop     
    help, h  Shows a list of commands or help for one command
+
    template:
      add     
      remove  

Release Notes

Add a newline between command categories.

abennett avatar Jan 26 '24 16:01 abennett

What's the best way to get this ported to v2 as well?

abennett avatar Jan 26 '24 16:01 abennett

@abennett You have a raise a PR against v2 as well. Can you fix the failing tests here ?

dearchap avatar Jan 28 '24 15:01 dearchap

@abennett You have a raise a PR against v2 as well. Can you fix the failing tests here ?

I can definitely create another PR. 👍

Uploading to codecov caused the failure. I could reattempt.

abennett avatar Jan 28 '24 15:01 abennett