Documentation
¶
Index ¶
Examples ¶
Constants ¶
View Source
const DefaultWidth = 80
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type OptionFunc ¶
type OptionFunc func(o *Options)
OptionFunc definition. It configures the Options, consistent with the banner, lists and table packages.
func WithAlignCenter ¶
func WithAlignCenter() OptionFunc
WithAlignCenter setting the title align to center
func WithAlignRight ¶
func WithAlignRight() OptionFunc
WithAlignRight setting the title align to right
func WithBorderBoth ¶
func WithBorderBoth() OptionFunc
WithBorderBoth setting the title border to both top and bottom
func WithBorderBottom ¶
func WithBorderBottom() OptionFunc
WithBorderBottom setting the title border to bottom
func WithBorderTop ¶
func WithBorderTop() OptionFunc
WithBorderTop setting the title border to top
Example ¶
ExampleBorderTop 演示顶部边框
package main
import (
"github.com/gookit/cliui/show/title"
)
func main() {
title.New("Top Border Title", title.WithBorderTop()).Println()
// 演示底部边框(默认)
title.New("Bottom Border Title", title.WithBorderBottom()).Println()
// 演示上下边框
title.New("Top and Bottom Border Title", title.WithBorderBoth()).Println()
// ExampleNoBorder 演示无边框
title.New("No Border Title", title.WithoutBorder()).Println()
}
Output:
func WithPercentWidth ¶ added in v0.4.0
func WithPercentWidth(percent int) OptionFunc
WithPercentWidth 使用终端宽度的百分比宽度
type Options ¶
type Options struct {
// Color 颜色Tag
Color string
// PaddingLR 是否左右填充 PaddingChar
PaddingLR bool
// PaddingChar 左右填充字符
PaddingChar rune
// 是否显示上下边框
ShowBorder bool
BorderChar rune
// BorderPos 边框位置 0: 无, 1: 上, 2: 下, 4: 上下
BorderPos cutypes.BorderPos
// 总的显示宽度
// - 0 表示使用默认宽度
Width int
// PercentWidth 使用终端宽度的百分比宽度 (1-100)
// 0 表示不使用百分比宽度
PercentWidth int
Indent int
Align comdef.Align
// contains filtered or unexported fields
}
Options title options
type Title ¶
Title 在终端中打印标题行
func (*Title) WithOptionFns ¶
func (t *Title) WithOptionFns(fns []OptionFunc) *Title
WithOptionFns 设置选项
Click to show internal directories.
Click to hide internal directories.