Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions command.go
Original file line number Diff line number Diff line change
Expand Up @@ -571,7 +571,7 @@ func defaultHelp(cmd *Command) error {
}

s.WriteString(colour.Title("Options"))
s.WriteString(":\n")
s.WriteString(":\n\n")
s.WriteString(usage)

// Subcommand help
Expand Down Expand Up @@ -643,7 +643,7 @@ func writeExamples(cmd *Command, s *strings.Builder) {

s.WriteString(colour.Title("Examples"))
s.WriteByte(':')
s.WriteByte('\n')
s.WriteString("\n\n")

s.WriteString(" # ")
s.WriteString(cmd.examples[0].comment)
Expand Down
2 changes: 1 addition & 1 deletion command_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -607,7 +607,7 @@ func TestHelp(t *testing.T) {

for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
snap := snapshot.New(t, snapshot.Update(*update))
snap := snapshot.New(t, snapshot.Update(*update), snapshot.Color(os.Getenv("CI") == ""))

stderr := &bytes.Buffer{}
stdout := &bytes.Buffer{}
Expand Down
1 change: 1 addition & 0 deletions testdata/snapshots/TestHelp/default_long.snap.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@ A placeholder for something cool
Usage: test [OPTIONS] ARGS...

Options:

-h --help bool Show help for test
-V --version bool Show version info for test
1 change: 1 addition & 0 deletions testdata/snapshots/TestHelp/default_short.snap.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@ A placeholder for something cool
Usage: test [OPTIONS] ARGS...

Options:

-h --help bool Show help for test
-V --version bool Show version info for test
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@ A longer, probably multiline description
Usage: test [OPTIONS] ARGS...

Options:

-h --help bool Show help for test
-V --version bool Show version info for test
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Commands:
very-long-subcommand Wow so long

Options:

-h --help bool Show help for test
-V --version bool Show version info for test

Expand Down
2 changes: 2 additions & 0 deletions testdata/snapshots/TestHelp/with_examples.snap.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@ A placeholder for something cool
Usage: test [OPTIONS] ARGS...

Examples:

# Do a thing
$ test do thing --now

# Do a different thing
$ test do thing --different

Options:

-h --help bool Show help for test
-V --version bool Show version info for test
1 change: 1 addition & 0 deletions testdata/snapshots/TestHelp/with_full_description.snap.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@ A longer, probably multiline description
Usage: test [OPTIONS] ARGS...

Options:

-h --help bool Show help for test
-V --version bool Show version info for test
1 change: 1 addition & 0 deletions testdata/snapshots/TestHelp/with_named_arguments.snap.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@ Arguments:
other Something else [default ""]

Options:

-h --help bool Show help for test
-V --version bool Show version info for test
1 change: 1 addition & 0 deletions testdata/snapshots/TestHelp/with_no_description.snap.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@ A placeholder for something cool
Usage: test [OPTIONS] ARGS...

Options:

-h --help bool Show help for test
-V --version bool Show version info for test
1 change: 1 addition & 0 deletions testdata/snapshots/TestHelp/with_subcommands.snap.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Commands:
sub2 Do another thing

Options:

-h --help bool Show help for test
-V --version bool Show version info for test

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Commands:
sub2 Do another thing

Options:

N/A --count int Count something [default: -1]
-d --delete bool Delete something
-h --help bool Show help for test
Expand Down
1 change: 1 addition & 0 deletions testdata/snapshots/TestHelp/with_verbosity_count.snap.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ Arguments:
dest Destination to copy to [default ./dest]

Options:

-h --help bool Show help for test
-v --verbosity count Increase the verbosity level
-V --version bool Show version info for test
Loading