September 26, 2023 TIL - How to Use a Multiline String Command Argument Input & Preserve the String's Newlines in the Output Using "Here Strings" and/or "Here Documents"
Using "Here Strings"/"Here Documents", we can use multiline strings as command argument inputs while preserving the newlines in the multiline string command output.
Using ankitpokhrel/jira-cli, add a multiline string comment to a Jira Issue & preserve any newlines.
Note: ankitpokhrel/jira-cli supports both Github-flavored and Jira-flavored markdown for writing comments.
# "Here String" Method
$ jira issue comment add --no-input ISSUE-1 "
# GFM Flavor H1
## GFM Flavor H2
- UL List Item 1
- UL List Item 2"
# "Here Document" Method
$ jira issue comment add --no-input ISSUE-1 --template - << EOF
# GFM Flavor H1
## GFM Flavor H2
- UL List Item 1
- UL List Item 2
EOF
- Use "Here Strings"/"Here Documents" to add multiline strings as command argument inputs while preserving the newlines in the multiline string command output
- Add multiline string comments to Jira Issues from the CLI using ankitpokhrel/jira-cli + "Here Strings"/"Here Documents"