File: main.go

package info (click to toggle)
golang-github-pterm-pterm 0.12.79-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 3,640 kB
  • sloc: makefile: 4
file content (23 lines) | stat: -rw-r--r-- 1,160 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
package main

import "github.com/pterm/pterm"

func main() {
	// Define a long text to be printed as a paragraph.
	longText := "This is a custom paragraph printer. As you can see, no words are separated, " +
		"but the text is split at the spaces. This is useful for continuous text of all kinds. You can manually change the line width if you want to." +
		"Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam"

	// Print the long text as a paragraph with a custom maximal width of 60 characters.
	pterm.DefaultParagraph.WithMaxWidth(60).Println(longText)

	// Print a line space to separate the paragraph from the following text.
	pterm.Println()

	// Define another long text to be printed without a paragraph printer.
	longTextWithoutParagraph := "This text is written with the default Println() function. No intelligent splitting here." +
		"Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam"

	// Print the long text without using a paragraph printer.
	pterm.Println(longTextWithoutParagraph)
}