repo-sync/main.go
James Coleman b9cc35b1a1
Some checks are pending
Go package / build (push) Waiting to run
first commit
2026-07-27 14:20:53 -05:00

29 lines
698 B
Go

package main
import (
"fmt"
cfg "github.com/grmrgecko/repo-sync/config"
"github.com/grmrgecko/repo-sync/fetch"
log "github.com/sirupsen/logrus"
)
// main parses the command line, configures logging, and dispatches to the
// selected command.
func main() {
ctx := ParseFlags()
setupLogging(flags.LogLevel)
fetch.SetUserAgent(fmt.Sprintf("%s/%s", cfg.Name, cfg.Version))
err := ctx.Run()
ctx.FatalIfErrorf(err)
}
// setupLogging configures the global logger from the command line level.
func setupLogging(level string) {
parsed, err := log.ParseLevel(level)
if err != nil {
parsed = log.InfoLevel
}
log.SetLevel(parsed)
log.SetFormatter(&log.TextFormatter{FullTimestamp: true})
}