Skip to content

Commit c4d2283

Browse files
Add extra padding in examples and options section (#167)
1 parent 3492d7b commit c4d2283

13 files changed

Lines changed: 15 additions & 3 deletions

command.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -571,7 +571,7 @@ func defaultHelp(cmd *Command) error {
571571
}
572572

573573
s.WriteString(colour.Title("Options"))
574-
s.WriteString(":\n")
574+
s.WriteString(":\n\n")
575575
s.WriteString(usage)
576576

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

644644
s.WriteString(colour.Title("Examples"))
645645
s.WriteByte(':')
646-
s.WriteByte('\n')
646+
s.WriteString("\n\n")
647647

648648
s.WriteString(" # ")
649649
s.WriteString(cmd.examples[0].comment)

command_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -607,7 +607,7 @@ func TestHelp(t *testing.T) {
607607

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

612612
stderr := &bytes.Buffer{}
613613
stdout := &bytes.Buffer{}

testdata/snapshots/TestHelp/default_long.snap.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,6 @@ A placeholder for something cool
33
Usage: test [OPTIONS] ARGS...
44

55
Options:
6+
67
-h --help bool Show help for test
78
-V --version bool Show version info for test

testdata/snapshots/TestHelp/default_short.snap.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,6 @@ A placeholder for something cool
33
Usage: test [OPTIONS] ARGS...
44

55
Options:
6+
67
-h --help bool Show help for test
78
-V --version bool Show version info for test

testdata/snapshots/TestHelp/full_description_strip_whitespace.snap.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,6 @@ A longer, probably multiline description
55
Usage: test [OPTIONS] ARGS...
66

77
Options:
8+
89
-h --help bool Show help for test
910
-V --version bool Show version info for test

testdata/snapshots/TestHelp/subcommands_different_lengths.snap.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ Commands:
1010
very-long-subcommand Wow so long
1111

1212
Options:
13+
1314
-h --help bool Show help for test
1415
-V --version bool Show version info for test
1516

testdata/snapshots/TestHelp/with_examples.snap.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,14 @@ A placeholder for something cool
33
Usage: test [OPTIONS] ARGS...
44

55
Examples:
6+
67
# Do a thing
78
$ test do thing --now
89

910
# Do a different thing
1011
$ test do thing --different
1112

1213
Options:
14+
1315
-h --help bool Show help for test
1416
-V --version bool Show version info for test

testdata/snapshots/TestHelp/with_full_description.snap.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,6 @@ A longer, probably multiline description
55
Usage: test [OPTIONS] ARGS...
66

77
Options:
8+
89
-h --help bool Show help for test
910
-V --version bool Show version info for test

testdata/snapshots/TestHelp/with_named_arguments.snap.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,6 @@ Arguments:
88
other Something else [default ""]
99

1010
Options:
11+
1112
-h --help bool Show help for test
1213
-V --version bool Show version info for test

testdata/snapshots/TestHelp/with_no_description.snap.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,6 @@ A placeholder for something cool
33
Usage: test [OPTIONS] ARGS...
44

55
Options:
6+
67
-h --help bool Show help for test
78
-V --version bool Show version info for test

0 commit comments

Comments
 (0)