Skip to content

Commit e3f52c9

Browse files
authored
(DOCSP-26295) Fixes incorrect indentation on examples (#29)
1 parent fdfce4c commit e3f52c9

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

cobra2snooty_test.go

Lines changed: 3 additions & 5 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,8 +129,7 @@ func TestGenDocs(t *testing.T) {
129129
output := buf.String()
130130

131131
checkStringContains(t, output, Echo().Long)
132-
checkStringContains(t, output, `
133-
# Example with intro text
132+
checkStringContains(t, output, `# Example with intro text
134133
atlas command no intro text
135134
`)
136135
checkStringContains(t, output, "boolone")
@@ -157,8 +156,7 @@ func TestGenDocsNoHiddenParents(t *testing.T) {
157156
output := buf.String()
158157

159158
checkStringContains(t, output, Echo().Long)
160-
checkStringContains(t, output, `
161-
# Example with intro text
159+
checkStringContains(t, output, `# Example with intro text
162160
atlas command no intro text
163161
`)
164162
checkStringContains(t, output, "boolone")

examples.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ func printExamples(buf *bytes.Buffer, cmd *cobra.Command) {
3939
for _, example := range examples[0:] {
4040
comment := ""
4141
if strings.Contains(cmd.Example, "#") {
42-
comment = "#"
42+
comment = " #"
4343
}
4444
buf.WriteString(`.. code-block::
4545
`)

0 commit comments

Comments
 (0)