-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Example of how to do bash in our CLI help
* Use the pretty.LongDesc function (which doesn't pipe it through markdown -> ascii) * Use pretty.Bash helper to avoid problems with backticks in go-backtick-quoted-strings * Make sure indentation is consistent
- Loading branch information
Showing
3 changed files
with
34 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package pretty | ||
|
||
import ( | ||
"fmt" | ||
"github.com/MakeNowJust/heredoc" | ||
"strings" | ||
) | ||
|
||
func Bash(s string) string { | ||
return fmt.Sprintf("`%s`", s) | ||
} | ||
|
||
func LongDesc(s string) string { | ||
s = heredoc.Doc(s) | ||
s = strings.TrimSpace(s) | ||
return s | ||
} |