mirror of
https://github.com/eosswedenorg/thalos
synced 2026-06-17 04:30:03 +02:00
cmd/thalos/main.go: move cli flags to internal/config/cli.go as it is easier to write tests if we can get a hold of the flags.
This commit is contained in:
parent
117f1b50b4
commit
beb5b6cf04
3 changed files with 18 additions and 16 deletions
|
|
@ -1,9 +1,9 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"github.com/eosswedenorg/thalos/internal/config"
|
||||
log "github.com/sirupsen/logrus"
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/spf13/pflag"
|
||||
)
|
||||
|
||||
var VersionString string = "dev"
|
||||
|
|
@ -27,17 +27,7 @@ func init() {
|
|||
`)
|
||||
rootCmd.SetVersionTemplate(`{{with .Name}}{{printf "%s " .}}{{end}}{{printf "v%s" .Version}}` + "\n")
|
||||
|
||||
flags := pflag.FlagSet{}
|
||||
flags.StringP("config", "c", "./config.yml", "Config file to read")
|
||||
flags.StringP("level", "L", "info", "Log level to use")
|
||||
flags.StringP("log", "l", "", "Path to log file (default: print to stdout/stderr)")
|
||||
flags.StringP("pid", "p", "", "Where to write process id")
|
||||
flags.BoolP("no-state-cache", "n", false, "Force the application to take start block from config/api")
|
||||
|
||||
flags.Int("start-block", 0, "Start to stream from this block (default: config value, cache, head from api)")
|
||||
flags.Int("end-block", 0, "Stop streaming when this block is reached")
|
||||
|
||||
rootCmd.PersistentFlags().AddFlagSet(&flags)
|
||||
rootCmd.PersistentFlags().AddFlagSet(config.GetFlags())
|
||||
}
|
||||
|
||||
func main() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue