mirror of
https://github.com/eosswedenorg/thalos
synced 2026-06-19 04:50:02 +02:00
refactor cli to use cobra.
This commit is contained in:
parent
fad70e19b9
commit
59480533d3
11 changed files with 236 additions and 289 deletions
|
|
@ -3,16 +3,15 @@ package config
|
|||
import (
|
||||
"path"
|
||||
|
||||
"github.com/urfave/cli/v2"
|
||||
"github.com/spf13/pflag"
|
||||
)
|
||||
|
||||
// Read cli flag values into the config
|
||||
func (cfg *Config) ReadCliFlags(ctx *cli.Context) error {
|
||||
logFile := ctx.Path("log")
|
||||
func (cfg *Config) ReadCliFlags(flags *pflag.FlagSet) error {
|
||||
logFile, _ := flags.GetString("log")
|
||||
if len(logFile) > 0 {
|
||||
cfg.Log.Directory = path.Dir(logFile)
|
||||
cfg.Log.Filename = path.Base(logFile)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue