all repos — erl @ ad8f97f9fb886a7c2e7ef7ef8a738ae7f0c9ddf5

Execute Reload Loop

feat: add quiet flag

Alan Pearce
commit

ad8f97f9fb886a7c2e7ef7ef8a738ae7f0c9ddf5

parent

921c8f0ae3eec6acf4f3cfb236f3a7f0869006e9

1 file changed, 35 insertions(+), 0 deletions(-)

changed files
A output/output.go
@@ -0,0 +1,35 @@
+package output + +import ( + "io" + + "github.com/fatih/color" +) + +type Output struct { + Writer io.Writer + + fail, info, success *color.Color +} + +func New(writer io.Writer) Output { + return Output{ + Writer: writer, + + fail: color.New(color.FgRed), + info: color.New(), + success: color.New(color.FgGreen), + } +} + +func (o Output) Fail(format string, args ...any) { + o.fail.Fprintf(o.Writer, format, args...) +} + +func (o Output) Info(format string, args ...any) { + o.info.Fprintf(o.Writer, format, args...) +} + +func (o Output) Success(format string, args ...any) { + o.success.Fprintf(o.Writer, format, args...) +}