mirror of
https://github.com/mudler/luet.git
synced 2025-09-15 23:00:04 +00:00
Update vendor
This commit is contained in:
30
vendor/github.com/jedib0t/go-pretty/v6/list/README.md
generated
vendored
Normal file
30
vendor/github.com/jedib0t/go-pretty/v6/list/README.md
generated
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
## List
|
||||
[](https://godoc.org/github.com/jedib0t/go-pretty/list)
|
||||
|
||||
Pretty-print lists with multiple levels/indents into ASCII/Unicode strings.
|
||||
|
||||
- Append Items one-by-one or as a group
|
||||
- Indent/UnIndent as you like
|
||||
- Support Items with Multiple-lines
|
||||
- Mirror output to an io.Writer object (like os.StdOut)
|
||||
- Completely customizable styles
|
||||
- Many ready-to-use styles: [style.go](style.go)
|
||||
- Render as:
|
||||
- (ASCII/Unicode) List
|
||||
- HTML List (with custom CSS Class)
|
||||
- Markdown List
|
||||
|
||||
```
|
||||
■ Game Of Thrones
|
||||
■ Winter
|
||||
■ Is
|
||||
■ Coming
|
||||
■ This
|
||||
■ Is
|
||||
■ Known
|
||||
■ The Dark Tower
|
||||
■ The Gunslinger
|
||||
```
|
||||
|
||||
A demonstration of all the capabilities can be found here:
|
||||
[../cmd/demo-list](../cmd/demo-list)
|
174
vendor/github.com/jedib0t/go-pretty/v6/list/list.go
generated
vendored
Normal file
174
vendor/github.com/jedib0t/go-pretty/v6/list/list.go
generated
vendored
Normal file
@@ -0,0 +1,174 @@
|
||||
package list
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
"strings"
|
||||
"unicode/utf8"
|
||||
)
|
||||
|
||||
const (
|
||||
// DefaultHTMLCSSClass stores the css-class to use when none-provided via
|
||||
// SetHTMLCSSClass(cssClass string).
|
||||
DefaultHTMLCSSClass = "go-pretty-table"
|
||||
)
|
||||
|
||||
// listItem represents one line in the List
|
||||
type listItem struct {
|
||||
Level int
|
||||
Text string
|
||||
}
|
||||
|
||||
// List helps print a 2-dimensional array in a human readable pretty-List.
|
||||
type List struct {
|
||||
// approxSize stores the approximate output length/size
|
||||
approxSize int
|
||||
// htmlCSSClass stores the HTML CSS Class to use on the <ul> node
|
||||
htmlCSSClass string
|
||||
// items contains the list of items to render
|
||||
items []*listItem
|
||||
// level stores the current indentation level
|
||||
level int
|
||||
// outputMirror stores an io.Writer where the "Render" functions would write
|
||||
outputMirror io.Writer
|
||||
// style contains all the strings used to draw the List, and more
|
||||
style *Style
|
||||
}
|
||||
|
||||
// AppendItem appends the item to the List of items to render.
|
||||
func (l *List) AppendItem(item interface{}) {
|
||||
l.items = append(l.items, l.analyzeAndStringify(item))
|
||||
}
|
||||
|
||||
// AppendItems appends the items to the List of items to render.
|
||||
func (l *List) AppendItems(items []interface{}) {
|
||||
for _, item := range items {
|
||||
l.AppendItem(item)
|
||||
}
|
||||
}
|
||||
|
||||
// Indent indents the following items to appear right-shifted.
|
||||
func (l *List) Indent() {
|
||||
if len(l.items) == 0 {
|
||||
// should not indent when there is no item in the current level
|
||||
} else if l.level > l.items[len(l.items)-1].Level {
|
||||
// already indented compared to previous item; do not indent more
|
||||
} else {
|
||||
l.level++
|
||||
}
|
||||
}
|
||||
|
||||
// Length returns the number of items to be rendered.
|
||||
func (l *List) Length() int {
|
||||
return len(l.items)
|
||||
}
|
||||
|
||||
// Reset sets the List to its initial state.
|
||||
func (l *List) Reset() {
|
||||
l.approxSize = 0
|
||||
l.items = make([]*listItem, 0)
|
||||
l.level = 0
|
||||
l.style = nil
|
||||
}
|
||||
|
||||
// SetHTMLCSSClass sets the the HTML CSS Class to use on the <ul> node
|
||||
// when rendering the List in HTML format. Recursive lists would use a numbered
|
||||
// index suffix. For ex., if the cssClass is set as "foo"; the <ul> for level 0
|
||||
// would have the class set as "foo"; the <ul> for level 1 would have "foo-1".
|
||||
func (l *List) SetHTMLCSSClass(cssClass string) {
|
||||
l.htmlCSSClass = cssClass
|
||||
}
|
||||
|
||||
// SetOutputMirror sets an io.Writer for all the Render functions to "Write" to
|
||||
// in addition to returning a string.
|
||||
func (l *List) SetOutputMirror(mirror io.Writer) {
|
||||
l.outputMirror = mirror
|
||||
}
|
||||
|
||||
// SetStyle overrides the DefaultStyle with the provided one.
|
||||
func (l *List) SetStyle(style Style) {
|
||||
l.style = &style
|
||||
}
|
||||
|
||||
// Style returns the current style.
|
||||
func (l *List) Style() *Style {
|
||||
if l.style == nil {
|
||||
tempStyle := StyleDefault
|
||||
l.style = &tempStyle
|
||||
}
|
||||
return l.style
|
||||
}
|
||||
|
||||
func (l *List) analyzeAndStringify(item interface{}) *listItem {
|
||||
itemStr := fmt.Sprint(item)
|
||||
if strings.Contains(itemStr, "\t") {
|
||||
itemStr = strings.Replace(itemStr, "\t", " ", -1)
|
||||
}
|
||||
if strings.Contains(itemStr, "\r") {
|
||||
itemStr = strings.Replace(itemStr, "\r", "", -1)
|
||||
}
|
||||
return &listItem{
|
||||
Level: l.level,
|
||||
Text: itemStr,
|
||||
}
|
||||
}
|
||||
|
||||
// UnIndent un-indents the following items to appear left-shifted.
|
||||
func (l *List) UnIndent() {
|
||||
if l.level > 0 {
|
||||
l.level--
|
||||
}
|
||||
}
|
||||
|
||||
func (l *List) initForRender() {
|
||||
// pick a default style
|
||||
l.Style()
|
||||
|
||||
// calculate the approximate size needed by looking at all entries
|
||||
l.approxSize = 0
|
||||
for _, item := range l.items {
|
||||
// account for the following when incrementing approxSize:
|
||||
// 1. prefix, 2. padding, 3. bullet, 4. text, 5. newline
|
||||
l.approxSize += utf8.RuneCountInString(l.style.LinePrefix)
|
||||
if item.Level > 0 {
|
||||
l.approxSize += utf8.RuneCountInString(l.style.CharItemVertical) * item.Level
|
||||
}
|
||||
l.approxSize += utf8.RuneCountInString(l.style.CharItemVertical)
|
||||
l.approxSize += utf8.RuneCountInString(item.Text)
|
||||
l.approxSize += utf8.RuneCountInString(l.style.CharNewline)
|
||||
}
|
||||
|
||||
// default to a HTML CSS Class if none-defined
|
||||
if l.htmlCSSClass == "" {
|
||||
l.htmlCSSClass = DefaultHTMLCSSClass
|
||||
}
|
||||
}
|
||||
|
||||
func (l *List) hasMoreItemsInLevel(levelIdx int, fromItemIdx int) bool {
|
||||
for idx := fromItemIdx + 1; idx >= 0 && idx < len(l.items); idx++ {
|
||||
if l.items[idx].Level < levelIdx {
|
||||
return false
|
||||
} else if l.items[idx].Level == levelIdx {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (l *List) render(out *strings.Builder) string {
|
||||
outStr := out.String()
|
||||
if l.outputMirror != nil && len(outStr) > 0 {
|
||||
l.outputMirror.Write([]byte(outStr))
|
||||
l.outputMirror.Write([]byte("\n"))
|
||||
}
|
||||
return outStr
|
||||
}
|
||||
|
||||
// renderHint has hints for the Render*() logic
|
||||
type renderHint struct {
|
||||
isTopItem bool
|
||||
isFirstItem bool
|
||||
isOnlyItem bool
|
||||
isLastItem bool
|
||||
isBottomItem bool
|
||||
}
|
110
vendor/github.com/jedib0t/go-pretty/v6/list/render.go
generated
vendored
Normal file
110
vendor/github.com/jedib0t/go-pretty/v6/list/render.go
generated
vendored
Normal file
@@ -0,0 +1,110 @@
|
||||
package list
|
||||
|
||||
import (
|
||||
"strings"
|
||||
"unicode/utf8"
|
||||
)
|
||||
|
||||
// Render renders the List in a human-readable "pretty" format. Example:
|
||||
// * Game Of Thrones
|
||||
// * Winter
|
||||
// * Is
|
||||
// * Coming
|
||||
// * This
|
||||
// * Is
|
||||
// * Known
|
||||
// * The Dark Tower
|
||||
// * The Gunslinger
|
||||
func (l *List) Render() string {
|
||||
l.initForRender()
|
||||
|
||||
var out strings.Builder
|
||||
out.Grow(l.approxSize)
|
||||
for idx, item := range l.items {
|
||||
hint := renderHint{
|
||||
isTopItem: bool(idx == 0),
|
||||
isFirstItem: bool(idx == 0 || item.Level > l.items[idx-1].Level),
|
||||
isLastItem: !l.hasMoreItemsInLevel(item.Level, idx),
|
||||
isBottomItem: bool(idx == len(l.items)-1),
|
||||
}
|
||||
if hint.isFirstItem && hint.isLastItem {
|
||||
hint.isOnlyItem = true
|
||||
}
|
||||
l.renderItem(&out, idx, item, hint)
|
||||
}
|
||||
return l.render(&out)
|
||||
}
|
||||
|
||||
func (l *List) renderItem(out *strings.Builder, idx int, item *listItem, hint renderHint) {
|
||||
// when working on item number 2 or more, render a newline first
|
||||
if idx > 0 {
|
||||
out.WriteRune('\n')
|
||||
}
|
||||
|
||||
// format item.Text as directed in l.style
|
||||
itemStr := l.style.Format.Apply(item.Text)
|
||||
|
||||
// convert newlines if newlines are not "\n" in l.style
|
||||
if strings.Contains(itemStr, "\n") && l.style.CharNewline != "\n" {
|
||||
itemStr = strings.Replace(itemStr, "\n", l.style.CharNewline, -1)
|
||||
}
|
||||
|
||||
// render the item.Text line by line
|
||||
for lineIdx, lineStr := range strings.Split(itemStr, "\n") {
|
||||
if lineIdx > 0 {
|
||||
out.WriteRune('\n')
|
||||
}
|
||||
|
||||
// render the prefix or the leading text before the actual item
|
||||
l.renderItemBulletPrefix(out, idx, item.Level, lineIdx, hint)
|
||||
l.renderItemBullet(out, idx, item.Level, lineIdx, hint)
|
||||
|
||||
// render the actual item
|
||||
out.WriteString(lineStr)
|
||||
}
|
||||
}
|
||||
|
||||
func (l *List) renderItemBullet(out *strings.Builder, itemIdx int, itemLevel int, lineIdx int, hint renderHint) {
|
||||
if lineIdx > 0 {
|
||||
// multi-line item.Text
|
||||
if hint.isLastItem {
|
||||
out.WriteString(strings.Repeat(" ", utf8.RuneCountInString(l.style.CharItemVertical)))
|
||||
} else {
|
||||
out.WriteString(l.style.CharItemVertical)
|
||||
}
|
||||
} else {
|
||||
// single-line item.Text (or first line of a multi-line item.Text)
|
||||
if hint.isOnlyItem {
|
||||
if hint.isTopItem {
|
||||
out.WriteString(l.style.CharItemSingle)
|
||||
} else {
|
||||
out.WriteString(l.style.CharItemBottom)
|
||||
}
|
||||
} else if hint.isTopItem {
|
||||
out.WriteString(l.style.CharItemTop)
|
||||
} else if hint.isFirstItem {
|
||||
out.WriteString(l.style.CharItemFirst)
|
||||
} else if hint.isBottomItem || hint.isLastItem {
|
||||
out.WriteString(l.style.CharItemBottom)
|
||||
} else {
|
||||
out.WriteString(l.style.CharItemMiddle)
|
||||
}
|
||||
out.WriteRune(' ')
|
||||
}
|
||||
}
|
||||
|
||||
func (l *List) renderItemBulletPrefix(out *strings.Builder, itemIdx int, itemLevel int, lineIdx int, hint renderHint) {
|
||||
// write a prefix if one has been set in l.style
|
||||
if l.style.LinePrefix != "" {
|
||||
out.WriteString(l.style.LinePrefix)
|
||||
}
|
||||
|
||||
// render spaces and connectors until the item's position
|
||||
for levelIdx := 0; levelIdx < itemLevel; levelIdx++ {
|
||||
if l.hasMoreItemsInLevel(levelIdx, itemIdx) {
|
||||
out.WriteString(l.style.CharItemVertical)
|
||||
} else {
|
||||
out.WriteString(strings.Repeat(" ", utf8.RuneCountInString(l.style.CharItemVertical)))
|
||||
}
|
||||
}
|
||||
}
|
70
vendor/github.com/jedib0t/go-pretty/v6/list/render_html.go
generated
vendored
Normal file
70
vendor/github.com/jedib0t/go-pretty/v6/list/render_html.go
generated
vendored
Normal file
@@ -0,0 +1,70 @@
|
||||
package list
|
||||
|
||||
import (
|
||||
"html"
|
||||
"strconv"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// RenderHTML renders the List in the HTML format. Example:
|
||||
// <ul class="go-pretty-table">
|
||||
// <li>Game Of Thrones</li>
|
||||
// <ul class="go-pretty-table-1">
|
||||
// <li>Winter</li>
|
||||
// <li>Is</li>
|
||||
// <li>Coming</li>
|
||||
// <ul class="go-pretty-table-2">
|
||||
// <li>This</li>
|
||||
// <li>Is</li>
|
||||
// <li>Known</li>
|
||||
// </ul>
|
||||
// </ul>
|
||||
// <li>The Dark Tower</li>
|
||||
// <ul class="go-pretty-table-1">
|
||||
// <li>The Gunslinger</li>
|
||||
// </ul>
|
||||
// </ul>
|
||||
func (l *List) RenderHTML() string {
|
||||
l.initForRender()
|
||||
|
||||
var out strings.Builder
|
||||
if len(l.items) > 0 {
|
||||
l.htmlRenderRecursively(&out, 0, l.items[0])
|
||||
}
|
||||
return l.render(&out)
|
||||
}
|
||||
|
||||
func (l *List) htmlRenderRecursively(out *strings.Builder, idx int, item *listItem) int {
|
||||
linePrefix := strings.Repeat(" ", item.Level)
|
||||
|
||||
out.WriteString(linePrefix)
|
||||
out.WriteString("<ul class=\"")
|
||||
out.WriteString(l.htmlCSSClass)
|
||||
if item.Level > 0 {
|
||||
out.WriteRune('-')
|
||||
out.WriteString(strconv.Itoa(item.Level))
|
||||
}
|
||||
out.WriteString("\">\n")
|
||||
var numItemsRendered int
|
||||
for itemIdx := idx; itemIdx < len(l.items); itemIdx++ {
|
||||
if l.items[itemIdx].Level == item.Level {
|
||||
out.WriteString(linePrefix)
|
||||
out.WriteString(" <li>")
|
||||
out.WriteString(strings.Replace(html.EscapeString(l.items[itemIdx].Text), "\n", "<br/>", -1))
|
||||
out.WriteString("</li>\n")
|
||||
numItemsRendered++
|
||||
} else if l.items[itemIdx].Level > item.Level { // indent
|
||||
numItemsRenderedRecursively := l.htmlRenderRecursively(out, itemIdx, l.items[itemIdx])
|
||||
numItemsRendered += numItemsRenderedRecursively
|
||||
itemIdx += numItemsRenderedRecursively - 1
|
||||
if numItemsRendered > 0 {
|
||||
out.WriteRune('\n')
|
||||
}
|
||||
} else { // un-indent
|
||||
break
|
||||
}
|
||||
}
|
||||
out.WriteString(linePrefix)
|
||||
out.WriteString("</ul>")
|
||||
return numItemsRendered
|
||||
}
|
29
vendor/github.com/jedib0t/go-pretty/v6/list/render_markdown.go
generated
vendored
Normal file
29
vendor/github.com/jedib0t/go-pretty/v6/list/render_markdown.go
generated
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
package list
|
||||
|
||||
// RenderMarkdown renders the List in the Markdown format. Example:
|
||||
// * Game Of Thrones
|
||||
// * Winter
|
||||
// * Is
|
||||
// * Coming
|
||||
// * This
|
||||
// * Is
|
||||
// * Known
|
||||
// * The Dark Tower
|
||||
// * The Gunslinger
|
||||
func (l *List) RenderMarkdown() string {
|
||||
// make a copy of the original style and ensure it is restored on exit
|
||||
originalStyle := l.style
|
||||
defer func() {
|
||||
if originalStyle == nil {
|
||||
l.style = nil
|
||||
} else {
|
||||
l.SetStyle(*originalStyle)
|
||||
}
|
||||
}()
|
||||
|
||||
// override whatever style was set with StyleMarkdown
|
||||
l.SetStyle(StyleMarkdown)
|
||||
|
||||
// render like a regular list
|
||||
return l.Render()
|
||||
}
|
295
vendor/github.com/jedib0t/go-pretty/v6/list/style.go
generated
vendored
Normal file
295
vendor/github.com/jedib0t/go-pretty/v6/list/style.go
generated
vendored
Normal file
@@ -0,0 +1,295 @@
|
||||
package list
|
||||
|
||||
import "github.com/jedib0t/go-pretty/v6/text"
|
||||
|
||||
// Style declares how to render the List (items).
|
||||
type Style struct {
|
||||
Format text.Format // formatting for the Text
|
||||
CharItemSingle string // the bullet for a single-item list
|
||||
CharItemTop string // the bullet for the top-most item
|
||||
CharItemFirst string // the bullet for the first item
|
||||
CharItemMiddle string // the bullet for non-first/non-last item
|
||||
CharItemVertical string // the vertical connector from one bullet to the next
|
||||
CharItemBottom string // the bullet for the bottom-most item
|
||||
CharNewline string // new-line character to use
|
||||
LinePrefix string // prefix for every single line
|
||||
Name string // name of the Style
|
||||
}
|
||||
|
||||
var (
|
||||
// StyleDefault renders a List like below:
|
||||
// * Game Of Thrones
|
||||
// * Winter
|
||||
// * Is
|
||||
// * Coming
|
||||
// * This
|
||||
// * Is
|
||||
// * Known
|
||||
// * The Dark Tower
|
||||
// * The Gunslinger
|
||||
StyleDefault = Style{
|
||||
Format: text.FormatDefault,
|
||||
CharItemSingle: "*",
|
||||
CharItemTop: "*",
|
||||
CharItemFirst: "*",
|
||||
CharItemMiddle: "*",
|
||||
CharItemVertical: " ",
|
||||
CharItemBottom: "*",
|
||||
CharNewline: "\n",
|
||||
LinePrefix: "",
|
||||
Name: "StyleDefault",
|
||||
}
|
||||
|
||||
// StyleBulletCircle renders a List like below:
|
||||
// ● Game Of Thrones
|
||||
// ● Winter
|
||||
// ● Is
|
||||
// ● Coming
|
||||
// ● This
|
||||
// ● Is
|
||||
// ● Known
|
||||
// ● The Dark Tower
|
||||
// ● The Gunslinger
|
||||
StyleBulletCircle = Style{
|
||||
Format: text.FormatDefault,
|
||||
CharItemSingle: "●",
|
||||
CharItemTop: "●",
|
||||
CharItemFirst: "●",
|
||||
CharItemMiddle: "●",
|
||||
CharItemVertical: " ",
|
||||
CharItemBottom: "●",
|
||||
CharNewline: "\n",
|
||||
LinePrefix: "",
|
||||
Name: "StyleBulletCircle",
|
||||
}
|
||||
|
||||
// StyleBulletFlower renders a List like below:
|
||||
// ✽ Game Of Thrones
|
||||
// ✽ Winter
|
||||
// ✽ Is
|
||||
// ✽ Coming
|
||||
// ✽ This
|
||||
// ✽ Is
|
||||
// ✽ Known
|
||||
// ✽ The Dark Tower
|
||||
// ✽ The Gunslinger
|
||||
StyleBulletFlower = Style{
|
||||
Format: text.FormatDefault,
|
||||
CharItemSingle: "✽",
|
||||
CharItemTop: "✽",
|
||||
CharItemFirst: "✽",
|
||||
CharItemMiddle: "✽",
|
||||
CharItemVertical: " ",
|
||||
CharItemBottom: "✽",
|
||||
CharNewline: "\n",
|
||||
LinePrefix: "",
|
||||
Name: "StyleBulletFlower",
|
||||
}
|
||||
|
||||
// StyleBulletSquare renders a List like below:
|
||||
// ■ Game Of Thrones
|
||||
// ■ Winter
|
||||
// ■ Is
|
||||
// ■ Coming
|
||||
// ■ This
|
||||
// ■ Is
|
||||
// ■ Known
|
||||
// ■ The Dark Tower
|
||||
// ■ The Gunslinger
|
||||
StyleBulletSquare = Style{
|
||||
Format: text.FormatDefault,
|
||||
CharItemSingle: "■",
|
||||
CharItemTop: "■",
|
||||
CharItemFirst: "■",
|
||||
CharItemMiddle: "■",
|
||||
CharItemVertical: " ",
|
||||
CharItemBottom: "■",
|
||||
CharNewline: "\n",
|
||||
LinePrefix: "",
|
||||
Name: "StyleBulletSquare",
|
||||
}
|
||||
|
||||
// StyleBulletStar renders a List like below:
|
||||
// ★ Game Of Thrones
|
||||
// ★ Winter
|
||||
// ★ Is
|
||||
// ★ Coming
|
||||
// ★ This
|
||||
// ★ Is
|
||||
// ★ Known
|
||||
// ★ The Dark Tower
|
||||
// ★ The Gunslinger
|
||||
StyleBulletStar = Style{
|
||||
Format: text.FormatDefault,
|
||||
CharItemSingle: "★",
|
||||
CharItemTop: "★",
|
||||
CharItemFirst: "★",
|
||||
CharItemMiddle: "★",
|
||||
CharItemVertical: " ",
|
||||
CharItemBottom: "★",
|
||||
CharNewline: "\n",
|
||||
LinePrefix: "",
|
||||
Name: "StyleBulletStar",
|
||||
}
|
||||
|
||||
// StyleBulletTriangle renders a List like below:
|
||||
// ▶ Game Of Thrones
|
||||
// ▶ Winter
|
||||
// ▶ Is
|
||||
// ▶ Coming
|
||||
// ▶ This
|
||||
// ▶ Is
|
||||
// ▶ Known
|
||||
// ▶ The Dark Tower
|
||||
// ▶ The Gunslinger
|
||||
StyleBulletTriangle = Style{
|
||||
Format: text.FormatDefault,
|
||||
CharItemSingle: "▶",
|
||||
CharItemTop: "▶",
|
||||
CharItemFirst: "▶",
|
||||
CharItemMiddle: "▶",
|
||||
CharItemVertical: " ",
|
||||
CharItemBottom: "▶",
|
||||
CharNewline: "\n",
|
||||
LinePrefix: "",
|
||||
Name: "StyleBulletTriangle",
|
||||
}
|
||||
|
||||
// StyleConnectedBold renders a List like below:
|
||||
// ┏━ Game Of Thrones
|
||||
// ┃ ┣━ Winter
|
||||
// ┃ ┣━ Is
|
||||
// ┃ ┗━ Coming
|
||||
// ┃ ┣━ This
|
||||
// ┃ ┣━ Is
|
||||
// ┃ ┗━ Known
|
||||
// ┗━ The Dark Tower
|
||||
// ┗━ The Gunslinger
|
||||
StyleConnectedBold = Style{
|
||||
Format: text.FormatDefault,
|
||||
CharItemSingle: "━━",
|
||||
CharItemTop: "┏━",
|
||||
CharItemFirst: "┣━",
|
||||
CharItemMiddle: "┣━",
|
||||
CharItemVertical: "┃ ",
|
||||
CharItemBottom: "┗━",
|
||||
CharNewline: "\n",
|
||||
LinePrefix: "",
|
||||
Name: "StyleConnectedBold",
|
||||
}
|
||||
|
||||
// StyleConnectedDouble renders a List like below:
|
||||
// ╔═ Game Of Thrones
|
||||
// ║ ╠═ Winter
|
||||
// ║ ╠═ Is
|
||||
// ║ ╚═ Coming
|
||||
// ║ ╠═ This
|
||||
// ║ ╠═ Is
|
||||
// ║ ╚═ Known
|
||||
// ╚═ The Dark Tower
|
||||
// ╚═ The Gunslinger
|
||||
StyleConnectedDouble = Style{
|
||||
Format: text.FormatDefault,
|
||||
CharItemSingle: "══",
|
||||
CharItemTop: "╔═",
|
||||
CharItemFirst: "╠═",
|
||||
CharItemMiddle: "╠═",
|
||||
CharItemVertical: "║ ",
|
||||
CharItemBottom: "╚═",
|
||||
CharNewline: "\n",
|
||||
LinePrefix: "",
|
||||
Name: "StyleConnectedDouble",
|
||||
}
|
||||
|
||||
// StyleConnectedLight renders a List like below:
|
||||
// ┌─ Game Of Thrones
|
||||
// │ ├─ Winter
|
||||
// │ ├─ Is
|
||||
// │ └─ Coming
|
||||
// │ ├─ This
|
||||
// │ ├─ Is
|
||||
// │ └─ Known
|
||||
// └─ The Dark Tower
|
||||
// └─ The Gunslinger
|
||||
StyleConnectedLight = Style{
|
||||
Format: text.FormatDefault,
|
||||
CharItemSingle: "──",
|
||||
CharItemTop: "┌─",
|
||||
CharItemFirst: "├─",
|
||||
CharItemMiddle: "├─",
|
||||
CharItemVertical: "│ ",
|
||||
CharItemBottom: "└─",
|
||||
CharNewline: "\n",
|
||||
LinePrefix: "",
|
||||
Name: "StyleConnectedLight",
|
||||
}
|
||||
|
||||
// StyleConnectedRounded renders a List like below:
|
||||
// ╭─ Game Of Thrones
|
||||
// │ ├─ Winter
|
||||
// │ ├─ Is
|
||||
// │ ╰─ Coming
|
||||
// │ ├─ This
|
||||
// │ ├─ Is
|
||||
// │ ╰─ Known
|
||||
// ╰─ The Dark Tower
|
||||
// ╰─ The Gunslinger
|
||||
StyleConnectedRounded = Style{
|
||||
Format: text.FormatDefault,
|
||||
CharItemSingle: "──",
|
||||
CharItemTop: "╭─",
|
||||
CharItemFirst: "├─",
|
||||
CharItemMiddle: "├─",
|
||||
CharItemVertical: "│ ",
|
||||
CharItemBottom: "╰─",
|
||||
CharNewline: "\n",
|
||||
LinePrefix: "",
|
||||
Name: "StyleConnectedRounded",
|
||||
}
|
||||
|
||||
// StyleMarkdown renders a List like below:
|
||||
// * Game Of Thrones
|
||||
// * Winter
|
||||
// * Is
|
||||
// * Coming
|
||||
// * This
|
||||
// * Is
|
||||
// * Known
|
||||
// * The Dark Tower
|
||||
// * The Gunslinger
|
||||
StyleMarkdown = Style{
|
||||
Format: text.FormatDefault,
|
||||
CharItemSingle: "*",
|
||||
CharItemTop: "*",
|
||||
CharItemFirst: "*",
|
||||
CharItemMiddle: "*",
|
||||
CharItemVertical: " ",
|
||||
CharItemBottom: "*",
|
||||
CharNewline: "<br/>",
|
||||
LinePrefix: " ",
|
||||
Name: "StyleMarkdown",
|
||||
}
|
||||
|
||||
// styleTest renders a List like below:
|
||||
// t Game Of Thrones
|
||||
// |f Winter
|
||||
// |m Is
|
||||
// |b Coming
|
||||
// | f This
|
||||
// | m Is
|
||||
// | b Known
|
||||
// b The Dark Tower
|
||||
// b The Gunslinger
|
||||
styleTest = Style{
|
||||
Format: text.FormatDefault,
|
||||
CharItemSingle: "s",
|
||||
CharItemTop: "t",
|
||||
CharItemFirst: "f",
|
||||
CharItemMiddle: "m",
|
||||
CharItemVertical: "|",
|
||||
CharItemBottom: "b",
|
||||
CharNewline: "\n",
|
||||
LinePrefix: "",
|
||||
Name: "styleTest",
|
||||
}
|
||||
)
|
25
vendor/github.com/jedib0t/go-pretty/v6/list/writer.go
generated
vendored
Normal file
25
vendor/github.com/jedib0t/go-pretty/v6/list/writer.go
generated
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
package list
|
||||
|
||||
import "io"
|
||||
|
||||
// Writer declares the interfaces that can be used to setup and render a list.
|
||||
type Writer interface {
|
||||
AppendItem(item interface{})
|
||||
AppendItems(items []interface{})
|
||||
Indent()
|
||||
Length() int
|
||||
Render() string
|
||||
RenderHTML() string
|
||||
RenderMarkdown() string
|
||||
Reset()
|
||||
SetHTMLCSSClass(cssClass string)
|
||||
SetOutputMirror(mirror io.Writer)
|
||||
SetStyle(style Style)
|
||||
Style() *Style
|
||||
UnIndent()
|
||||
}
|
||||
|
||||
// NewWriter initializes and returns a Writer.
|
||||
func NewWriter() Writer {
|
||||
return &List{}
|
||||
}
|
Reference in New Issue
Block a user