Documentation ¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultStyle = BoxDrawStyle()
Functions ¶
This section is empty.
Types ¶
type Prefix ¶
type Prefix struct { Style *Style // contains filtered or unexported fields }
Example ¶
var pf Prefix exampleTree(&pf)
Output: This is some sort of preamble ┌─ Node 1 │ ├─ Node 1.1 │ │ This is more additional text │ │ for node 1.1. │ └─ Node 1.2 │ ├─ Node 1.2.1 │ │ By the way, this is what I want to add to 1.2.1! │ └─ Node 1.2.2 │ └─ Node 1.2.1.1 └─ Node 3 And finally a footer
Example (Ascii) ¶
pf := Prefix{Style: ASCIIStyle()} exampleTree(&pf)
Output: This is some sort of preamble ,-- Node 1 | +-- Node 1.1 | | This is more additional text | | for node 1.1. | `-- Node 1.2 | +-- Node 1.2.1 | | By the way, this is what I want to add to 1.2.1! | `-- Node 1.2.2 | `-- Node 1.2.1.1 `-- Node 3 And finally a footer
Example (Items) ¶
pf := Prefix{Style: ItemStyle()} exampleTree(&pf)
Output: This is some sort of preamble - Node 1 - Node 1.1 This is more additional text for node 1.1. - Node 1.2 - Node 1.2.1 By the way, this is what I want to add to 1.2.1! - Node 1.2.2 - Node 1.2.1.1 - Node 3 And finally a footer
type PrefixElement ¶
type PrefixElement int
const ( First PrefixElement = iota Next Cont Last )
func Branch ¶
func Branch(idx, len int) PrefixElement
func Root ¶
func Root(idx, len int) PrefixElement
type Style ¶
func ASCIIStyle ¶
func ASCIIStyle() *Style
func BoxDrawStyle ¶
func BoxDrawStyle() *Style
type Writer ¶
type Writer struct {
// contains filtered or unexported fields
}
Example ¶
w := NewWriter(os.Stdout, nil) io.WriteString(w, "This is some sort of preamble") io.WriteString(w.Descend().First(nil), "Node 1") io.WriteString(w.Descend().Next(nil), `Node 1.1 This is more additional text for node 1.1.`) io.WriteString(w.Last(nil), "Node 1.2") fmt.Fprint(w.Descend().Next(nil), "Node 1.2.1") fmt.Fprint(w, "By the way, this is what I want to add to 1.2.1!") fmt.Fprint(w.Last(nil), "Node 1.2.2") fmt.Fprint(w.Descend().Last(nil), "Node 1.2.2.1") fmt.Fprint(w.Ascend(3).Last(nil), "Node 3") fmt.Fprint(w.Ascend(1), "And finally a footer")
Output: This is some sort of preamble ┌─ Node 1 │ ├─ Node 1.1 │ │ This is more additional text │ │ for node 1.1. │ └─ Node 1.2 │ ├─ Node 1.2.1 │ │ By the way, this is what I want to add to 1.2.1! │ └─ Node 1.2.2 │ └─ Node 1.2.2.1 └─ Node 3 And finally a footer
Click to show internal directories.
Click to hide internal directories.