123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293 |
- package main
- import (
- "fmt"
- "git.swzry.com/zry/go-hhc-cli/hhc_common"
- "github.com/ttacon/chalk"
- )
- func main() {
- pm := []hhc_common.PrintableMessage{
- {
- Text: "Hakurei Reimu ",
- Style: chalk.Red.NewStyle().WithTextStyle(chalk.Underline),
- },
- {
- Text: "is a girl in gensokyo, ",
- Style: chalk.Blue.NewStyle().WithTextStyle(chalk.Italic),
- },
- {
- Text: "she is the miko of ",
- Style: chalk.Cyan.NewStyle(),
- },
- {
- Text: "Hakurei Shirine ",
- Style: chalk.Green.NewStyle().WithTextStyle(chalk.Bold),
- },
- {
- Text: ". She loves money and has no ",
- Style: chalk.White.NewStyle(),
- },
- {
- Text: "ethics.",
- Style: chalk.Magenta.NewStyle(),
- },
- {
- Text: "博丽灵梦",
- Style: chalk.Red.NewStyle().WithTextStyle(chalk.Underline),
- },
- {
- Text: "是一个幻想乡中的女孩,",
- Style: chalk.Blue.NewStyle().WithTextStyle(chalk.Italic),
- },
- {
- Text: "她是",
- Style: chalk.Cyan.NewStyle(),
- },
- {
- Text: "博丽神社",
- Style: chalk.Green.NewStyle().WithTextStyle(chalk.Bold),
- },
- {
- Text: "的一名巫女,她喜欢钱而且没有",
- Style: chalk.White.NewStyle(),
- },
- {
- Text: "节操。",
- Style: chalk.Magenta.NewStyle(),
- },
- }
- Pr(80, true, pm)
- Pr(80, false, pm)
- Pr(40, true, pm)
- Pr(40, false, pm)
- Pr(20, true, pm)
- Pr(20, false, pm)
- Pr(10, true, pm)
- Pr(10, false, pm)
- Pr(1, true, pm)
- Pr(1, false, pm)
- fmt.Println("=====================================")
- test2 := "Hakurei Reimu is a girl in gensokyo, she is the miko of Hakurei Shirine . She loves money and has no ethics. 博丽灵梦是一个幻想乡中的女孩,她是博丽神社的一名巫女,她喜欢钱而且没有节操。"
- Ps(80, test2)
- Ps(40, test2)
- Ps(20, test2)
- Ps(10, test2)
- Ps(1, test2)
- }
- func Pr(w int, c bool, pms []hhc_common.PrintableMessage) {
- lines := hhc_common.PrintPrintablMessagesIntoLines(pms, w, c)
- fmt.Println("TermWidth", w, "Colorful", c)
- for _, v := range lines {
- fmt.Println(v)
- }
- }
- func Ps(w int, s string) {
- lines := hhc_common.PrintStringIntoLines(s, w)
- fmt.Println("TermWidth", w)
- for _, v := range lines {
- fmt.Println(v)
- }
- }
|