tq: kill dead Meter option funcs

This commit is contained in:
rick olson 2017-12-07 14:57:33 -07:00
parent 92ec7ede00
commit eec39f073e

@ -38,48 +38,6 @@ type env interface {
Get(key string) (val string, ok bool)
}
type meterOption func(*Meter)
// WithLogFile is an option for NewMeter() that sends updates to a text file.
func WithLogFile(name string) meterOption {
printErr := func(err string) {
fmt.Fprintf(os.Stderr, "Error creating progress logger: %s\n", err)
}
return func(m *Meter) {
if len(name) == 0 {
return
}
if !filepath.IsAbs(name) {
printErr("GIT_LFS_PROGRESS must be an absolute path")
return
}
cbDir := filepath.Dir(name)
if err := os.MkdirAll(cbDir, 0755); err != nil {
printErr(err.Error())
return
}
file, err := os.OpenFile(name, os.O_WRONLY|os.O_CREATE|os.O_APPEND, 0666)
if err != nil {
printErr(err.Error())
return
}
m.logToFile = 1
m.logger = tools.NewSyncWriter(file)
}
}
// WithOSEnv is an option for NewMeter() that sends updates to the text file
// path specified in the OS Env.
func WithOSEnv(os env) meterOption {
name, _ := os.Get("GIT_LFS_PROGRESS")
return WithLogFile(name)
}
type MeterOption struct {
// DryRun is an option that determines whether updates should be sent to
// stdout.