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 Debug bool
DebugFlag = cli.BoolFlag{ DebugFlag = cli.BoolFlag{
Name: "debug", Name: "debug",
Usage: "Turn on debug logs", Usage: "(logging) Turn on debug logs",
Destination: &Debug, Destination: &Debug,
EnvVar: version.ProgramUpper + "_DEBUG", EnvVar: version.ProgramUpper + "_DEBUG",
} }

View File

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

View File

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

View File

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

View File

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