cli/aes/shortcut.go

30 lines
516 B
Go

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)
}