Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: urfave/cli
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v2.17.1
Choose a base ref
...
head repository: urfave/cli
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v2.17.2
Choose a head ref
  • 8 commits
  • 3 files changed
  • 3 contributors

Commits on Sep 29, 2022

  1. Remove nonexistent phony targets

    so that running `make` or `make all` only runs targets that exist.
    meatballhat committed Sep 29, 2022

    Verified

    This commit was signed with the committer’s verified signature.
    meatballhat Dan Buch
    Copy the full SHA
    ac4e514 View commit details

Commits on Sep 30, 2022

  1. Merge pull request #1503 from urfave/rm-nonexistent-phonies

    Remove nonexistent phony targets
    meatballhat authored Sep 30, 2022

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    6491dde View commit details

Commits on Oct 3, 2022

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    3f7774a View commit details
  2. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    59d5809 View commit details

Commits on Oct 4, 2022

  1. wrap: Simplify loop logic

    Suggested by @julian7
    abitrolly authored Oct 4, 2022

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    1d26960 View commit details
  2. Run go fmt

    abitrolly committed Oct 4, 2022
    Copy the full SHA
    359e5a8 View commit details
  3. Copy the full SHA
    15b2789 View commit details

Commits on Oct 5, 2022

  1. Merge pull request #1513 from abitrolly/patch-1

    wrap: Avoid trailing whitespace for empty lines
    dearchap authored Oct 5, 2022

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    8335f54 View commit details
Showing with 22 additions and 12 deletions.
  1. +1 −1 Makefile
  2. +11 −8 help.go
  3. +10 −3 help_test.go
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -7,7 +7,7 @@
GO_RUN_BUILD := go run internal/build/build.go

.PHONY: all
all: generate vet tag-test test check-binary-size tag-check-binary-size gfmrun yamlfmt v2diff
all: generate vet test check-binary-size gfmrun yamlfmt v2diff

# NOTE: this is a special catch-all rule to run any of the commands
# defined in internal/build/build.go with optional arguments passed
19 changes: 11 additions & 8 deletions help.go
Original file line number Diff line number Diff line change
@@ -468,25 +468,28 @@ func nindent(spaces int, v string) string {
}

func wrap(input string, offset int, wrapAt int) string {
var sb strings.Builder
var ss []string

lines := strings.Split(input, "\n")

padding := strings.Repeat(" ", offset)

for i, line := range lines {
if i != 0 {
sb.WriteString(padding)
}
if line == "" {
ss = append(ss, line)
} else {
wrapped := wrapLine(line, offset, wrapAt, padding)
if i == 0 {
ss = append(ss, wrapped)
} else {
ss = append(ss, padding+wrapped)

sb.WriteString(wrapLine(line, offset, wrapAt, padding))
}

if i != len(lines)-1 {
sb.WriteString("\n")
}
}

return sb.String()
return strings.Join(ss, "\n")
}

func wrapLine(input string, offset int, wrapAt int, padding string) string {
13 changes: 10 additions & 3 deletions help_test.go
Original file line number Diff line number Diff line change
@@ -1213,6 +1213,13 @@ func TestDefaultCompleteWithFlags(t *testing.T) {
}
}

func TestWrap(t *testing.T) {
emptywrap := wrap("", 4, 16)
if emptywrap != "" {
t.Errorf("Wrapping empty line should return empty line. Got '%s'.", emptywrap)
}
}

func TestWrappedHelp(t *testing.T) {

// Reset HelpPrinter after this test.
@@ -1276,7 +1283,7 @@ DESCRIPTION:
App.Description string long
enough that it should be
wrapped in this test
with a newline
and an indented line
@@ -1294,8 +1301,8 @@ COPYRIGHT:
that it should be wrapped.
Including newlines.
And also indented lines.
And then another long line.
Blah blah blah does anybody
ever read these things?