2017-07-14 01:02:30 +02:00
|
|
|
package cmd
|
2017-07-02 15:38:00 +02:00
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
|
2017-07-09 22:17:20 +02:00
|
|
|
"github.com/osteele/gojekyll/utils"
|
2017-07-02 15:38:00 +02:00
|
|
|
)
|
|
|
|
|
2017-07-03 19:16:25 +02:00
|
|
|
type bannerLogger struct{ labelWidth int }
|
2017-07-02 15:38:00 +02:00
|
|
|
|
2017-07-03 19:16:25 +02:00
|
|
|
var logger = bannerLogger{}
|
|
|
|
|
|
|
|
func (l *bannerLogger) Info(a ...interface{}) {
|
|
|
|
fmt.Println(a...)
|
2017-07-02 15:38:00 +02:00
|
|
|
}
|
|
|
|
|
2017-07-03 19:16:25 +02:00
|
|
|
func (l *bannerLogger) label(label string, msg string, a ...interface{}) {
|
|
|
|
if len(label) > l.labelWidth {
|
|
|
|
l.labelWidth = len(label)
|
2017-07-02 15:38:00 +02:00
|
|
|
}
|
|
|
|
if !quiet {
|
2017-07-09 22:17:20 +02:00
|
|
|
fmt.Printf("%s %s\n", utils.LeftPad(label, l.labelWidth), fmt.Sprintf(msg, a...))
|
2017-07-02 15:38:00 +02:00
|
|
|
}
|
|
|
|
}
|
2017-07-03 19:16:25 +02:00
|
|
|
|
|
|
|
func (l *bannerLogger) path(label string, filename string) {
|
2017-07-09 22:17:20 +02:00
|
|
|
l.label(label, utils.MustAbs(filename))
|
2017-07-03 19:16:25 +02:00
|
|
|
}
|