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