Skip to content

Commit

Permalink
Support body headspace
Browse files Browse the repository at this point in the history
Signed-off-by: Hunter Gatewood <[email protected]>
  • Loading branch information
hcgatewood committed Jun 9, 2021
1 parent c272ea8 commit 884fc0a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
7 changes: 4 additions & 3 deletions lib/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -220,14 +220,15 @@ func parseIssue(cfg *Config, inp string) (github.IssueRequest, error) {
}

func getBody(cfg *Config, inp string) *string {
if inp == "" {
trimmed := strings.TrimSpace(inp)
if trimmed == "" {
return nil
}
if cfg.Byline {
s := fmt.Sprintf("%s\n\n\n%s", inp, Byline)
s := fmt.Sprintf("%s\n\n\n%s", trimmed, Byline)
return &s
}
return &inp
return &trimmed
}

func parseList(inp string) *[]string {
Expand Down
2 changes: 1 addition & 1 deletion lib/create_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ func TestCreate(t *testing.T) {
{
Title: github.String("Multiple title B"),
Labels: &[]string{"label2"},
Body: github.String("Short body"),
Body: github.String("Short body with headspace"),
},
{
Title: github.String("Multiple title C"),
Expand Down
3 changes: 2 additions & 1 deletion testdata/multiple.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ And hyphens that are newline-anchored but only 2
Also add some unicode for fun 👉🌟
---
Multiple title B | label2
Short body

Short body with headspace
---
Multiple title C | |

0 comments on commit 884fc0a

Please sign in to comment.