File: README.md

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 (45 lines) | stat: -rw-r--r-- 1,262 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
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
### prefix/demo

![Animation](https://raw.githubusercontent.com/pterm/pterm/master/_examples/prefix/demo/animation.svg)

<details>

<summary>SHOW SOURCE</summary>

```go
package main

import "github.com/pterm/pterm"

func main() {
	// Enable debug messages in PTerm.
	pterm.EnableDebugMessages()

	// Print a debug message with PTerm.
	pterm.Debug.Println("Hello, World!")

	// Print an informational message with PTerm.
	pterm.Info.Println("Hello, World!")

	// Print a success message with PTerm.
	pterm.Success.Println("Hello, World!")

	// Print a warning message with PTerm.
	pterm.Warning.Println("Hello, World!")

	// Print an error message with PTerm. This will also display the filename and line number in the terminal.
	pterm.Error.Println("Errors show the filename and linenumber inside the terminal!")

	// Print an informational message with PTerm, with line number.
	// This demonstrates that other PrefixPrinters can also display line numbers.
	pterm.Info.WithShowLineNumber().Println("Other PrefixPrinters can do that too!")

	// Temporarily set Fatal to false, so that the CI won't crash.
	// This will print a fatal message with PTerm, but won't terminate the program.
	pterm.Fatal.WithFatal(false).Println("Hello, World!")
}

```

</details>