Documentation
¶
Overview ¶
Package indent provides a wrapper to a Writer interface that inserts a leveled preface to the beginning of each line.
Example ¶
w := New(os.Stdout, "\t") fmt.Fprintln(w, "level 0") Increase(w) fmt.Fprintln(w, "level 1") Increase(w) fmt.Fprintln(w, "level 2") Increase(w) fmt.Fprintln(w, "level 3") Decrease(w) fmt.Fprintln(w, "back to level 2") Decrease(w) fmt.Fprintln(w, "back to level 1") Increase(w) fmt.Fprintln(w, "another level 2") Decrease(w) Decrease(w) fmt.Fprintln(w, "back level 0") Decrease(w) fmt.Fprintln(w, "caught -1") Increase(w) fmt.Fprintln(w, "level 1")
Output: level 0 level 1 level 2 level 3 back to level 2 back to level 1 another level 2 back level 0 caught -1 level 1
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Decrease ¶
Decrease the preface repetition level for the given or embedded indentor. This will not go below zero.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.