Merge remote-tracking branch 'upstream/master' into issue-112

This commit is contained in:
Brian Downs 2020-09-03 17:26:48 -07:00
commit 898cbeb9b6
5 changed files with 15 additions and 15 deletions

View File

@ -13,7 +13,7 @@ var (
Debug bool
DebugFlag = cli.BoolFlag{
Name: "debug",
Usage: "Turn on debug logs",
Usage: "(logging) Turn on debug logs",
Destination: &Debug,
EnvVar: version.ProgramUpper + "_DEBUG",
}

View File

@ -77,6 +77,8 @@ func NewServerCommand(action func(*cli.Context) error) cli.Command {
Before: SetupDebug(CheckSELinuxFlags),
Action: action,
Flags: []cli.Flag{
ConfigFlag,
DebugFlag,
VLevel,
VModule,
LogFile,

View File

@ -104,15 +104,11 @@ func readConfigFile(file string) (result []string, _ error) {
if slice, ok := v.([]interface{}); ok {
for _, v := range slice {
result = append(result, prefix+k, convert.ToString(v))
result = append(result)
result = append(result, prefix+k+"="+convert.ToString(v))
}
} else {
str := convert.ToString(v)
result = append(result, prefix+k)
if str != "" {
result = append(result, str)
}
result = append(result, prefix+k+"="+str)
}
}

View File

@ -150,14 +150,15 @@ func TestConfigFile(t *testing.T) {
func TestParse(t *testing.T) {
testDataOutput := []string{
"--foo-bar", "baz",
"--a-slice", "1",
"--a-slice", "2",
"--a-slice", "",
"--a-slice", "three",
"--isempty",
"-c", "b",
"--islast", "true",
"--foo-bar=baz",
"--a-slice=1",
"--a-slice=2",
"--a-slice=",
"--a-slice=three",
"--isempty=",
"-c=b",
"--isfalse=false",
"--islast=true",
}
defParser := Parser{

View File

@ -6,4 +6,5 @@ a-slice:
- three
isempty:
c: b
isfalse: false
islast: true