From 53baae8a7ff629e65963602e0cb6c955c2b36f20 Mon Sep 17 00:00:00 2001 From: Henrik Hautakoski Date: Sun, 18 Feb 2024 17:40:04 +0100 Subject: [PATCH] internal/config/cli.go: move flags that are not bound to config to cmd/thalos/main.go --- cmd/thalos/main.go | 9 +++++++++ internal/config/cli.go | 6 ------ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/cmd/thalos/main.go b/cmd/thalos/main.go index b2d8f33..fc55eef 100644 --- a/cmd/thalos/main.go +++ b/cmd/thalos/main.go @@ -4,6 +4,7 @@ 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,6 +28,14 @@ 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("pid", "p", "", "Where to write process id") + flags.BoolP("no-state-cache", "n", false, "Force the application to take start block from config/api") + + rootCmd.PersistentFlags().AddFlagSet(&flags) rootCmd.PersistentFlags().AddFlagSet(config.GetFlags()) } diff --git a/internal/config/cli.go b/internal/config/cli.go index 5baecdb..c5b3c95 100644 --- a/internal/config/cli.go +++ b/internal/config/cli.go @@ -11,12 +11,6 @@ import ( func GetFlags() *pflag.FlagSet { flags := pflag.FlagSet{} - // Cli only flags - flags.StringP("config", "c", "./config.yml", "Config file to read") - flags.StringP("level", "L", "info", "Log level to use") - 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") - // Generic flags.StringP("url", "u", "", "Url to antelope api") flags.String("codec", "json", "Codec used to send messages")