Skip to content

Commit

Permalink
fix printing default config file path (#2060)
Browse files Browse the repository at this point in the history
  • Loading branch information
Steffen Siering authored and tsg committed Jul 19, 2016
1 parent 7bd61bf commit 2e761cd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion libbeat/cfgfile/cfgfile.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ var (
// The default config cannot include the beat name as it is not initialized
// when this variable is created. See ChangeDefaultCfgfileFlag which should
// be called prior to flags.Parse().
configfiles = flagArgList("c", "beat.yml", "Configuration file")
configfiles = flagArgList("c", "beat.yml", "Configuration file `path`")
overwrites = common.NewFlagConfig(nil, nil, "E", "Configuration overwrite")
testConfig = flag.Bool("configtest", false, "Test configuration and exit.")

Expand Down
6 changes: 6 additions & 0 deletions libbeat/cfgfile/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
type argList struct {
list []string
isDefault bool
f *flag.Flag
}

func flagArgList(name string, def string, usage string) *argList {
Expand All @@ -16,10 +17,15 @@ func flagArgList(name string, def string, usage string) *argList {
isDefault: true,
}
flag.Var(l, name, usage)
l.f = flag.Lookup(name)
if l.f == nil {
panic("Failed to lookup registered flag")
}
return l
}

func (l *argList) SetDefault(v string) {
l.f.DefValue = v
l.list = []string{v}
l.isDefault = true
}
Expand Down

0 comments on commit 2e761cd

Please sign in to comment.