Skip to content

Commit

Permalink
(DOCSP-26295) Fixes incorrect indentation on examples (#29)
Browse files Browse the repository at this point in the history
  • Loading branch information
sarahsimpers authored Nov 16, 2022
1 parent fdfce4c commit e3f52c9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
8 changes: 3 additions & 5 deletions cobra2snooty_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ func Echo() *cobra.Command {
Aliases: []string{"say"},
Short: "Echo anything to the screen",
Long: "an utterly useless command for testing",
Example: " # Example with intro text\n atlas command no intro text\n",
Example: "# Example with intro text\n atlas command no intro text\n",
Annotations: map[string]string{
"string to printDesc": "A string to print",
"test paramDesc": "just for testing",
Expand Down Expand Up @@ -129,8 +129,7 @@ func TestGenDocs(t *testing.T) {
output := buf.String()

checkStringContains(t, output, Echo().Long)
checkStringContains(t, output, `
# Example with intro text
checkStringContains(t, output, `# Example with intro text
atlas command no intro text
`)
checkStringContains(t, output, "boolone")
Expand All @@ -157,8 +156,7 @@ func TestGenDocsNoHiddenParents(t *testing.T) {
output := buf.String()

checkStringContains(t, output, Echo().Long)
checkStringContains(t, output, `
# Example with intro text
checkStringContains(t, output, `# Example with intro text
atlas command no intro text
`)
checkStringContains(t, output, "boolone")
Expand Down
2 changes: 1 addition & 1 deletion examples.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func printExamples(buf *bytes.Buffer, cmd *cobra.Command) {
for _, example := range examples[0:] {
comment := ""
if strings.Contains(cmd.Example, "#") {
comment = "#"
comment = " #"
}
buf.WriteString(`.. code-block::
`)
Expand Down

0 comments on commit e3f52c9

Please sign in to comment.