cli/aes/shortcut.go

31 lines
516 B
Go
Raw Normal View History

2024-06-05 14:18:54 +03:00
package aes
import "fmt"
type EffectText struct {
Effects Effects
Text string
}
func (et EffectText) String() string {
return fmt.Sprintf(
CSI+"%sm%s"+CSI+"0m",
et.Effects.Format(), et.Text,
)
}
func ETF(format string, v ...any) EffectText {
ret := EffectText{}
ret.Text = fmt.Sprintf(format, v...)
return ret
}
func (et EffectText) With(effects ...Effect) EffectText {
et.Effects = append(et.Effects, effects...)
return et
}
func (et EffectText) Bold() EffectText {
return et.With(EffectBold)
}