Skip to content

Commit fdfce4c

Browse files
authored
DOCSP-26295: Fixes incorrect spacing for commands without # (#27)
1 parent 81c0363 commit fdfce4c

File tree

2 files changed

+8
-10
lines changed

2 files changed

+8
-10
lines changed

cobra2snooty_test.go

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ func Echo() *cobra.Command {
7171
Aliases: []string{"say"},
7272
Short: "Echo anything to the screen",
7373
Long: "an utterly useless command for testing",
74-
Example: " # Example with intro text\n atlas command no intro text\n",
74+
Example: " # Example with intro text\n atlas command no intro text\n",
7575
Annotations: map[string]string{
7676
"string to printDesc": "A string to print",
7777
"test paramDesc": "just for testing",
@@ -129,10 +129,9 @@ func TestGenDocs(t *testing.T) {
129129
output := buf.String()
130130

131131
checkStringContains(t, output, Echo().Long)
132-
checkStringContains(t, output, `.. code-block::
133-
134-
# Example with intro text
135-
atlas command no intro text
132+
checkStringContains(t, output, `
133+
# Example with intro text
134+
atlas command no intro text
136135
`)
137136
checkStringContains(t, output, "boolone")
138137
checkStringContains(t, output, "rootflag")
@@ -158,10 +157,9 @@ func TestGenDocsNoHiddenParents(t *testing.T) {
158157
output := buf.String()
159158

160159
checkStringContains(t, output, Echo().Long)
161-
checkStringContains(t, output, `.. code-block::
162-
163-
# Example with intro text
164-
atlas command no intro text
160+
checkStringContains(t, output, `
161+
# Example with intro text
162+
atlas command no intro text
165163
`)
166164
checkStringContains(t, output, "boolone")
167165
checkStringOmits(t, output, "rootflag")

examples.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,6 @@ func printExamples(buf *bytes.Buffer, cmd *cobra.Command) {
4343
}
4444
buf.WriteString(`.. code-block::
4545
`)
46-
buf.WriteString(fmt.Sprintf("\n %s%s\n", comment, indentString(example, identChar)))
46+
buf.WriteString(fmt.Sprintf("\n %s%s\n", comment, indentString(example, identChar)))
4747
}
4848
}

0 commit comments

Comments
 (0)