mirror of
https://github.com/k3s-io/k3s.git
synced 2024-06-07 19:41:36 +00:00
Merge remote-tracking branch 'upstream/master' into issue-112
This commit is contained in:
commit
898cbeb9b6
@ -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",
|
||||||
}
|
}
|
||||||
|
@ -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,
|
||||||
|
@ -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)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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{
|
||||||
|
1
pkg/configfilearg/testdata/data.yaml
vendored
1
pkg/configfilearg/testdata/data.yaml
vendored
@ -6,4 +6,5 @@ a-slice:
|
|||||||
- three
|
- three
|
||||||
isempty:
|
isempty:
|
||||||
c: b
|
c: b
|
||||||
|
isfalse: false
|
||||||
islast: true
|
islast: true
|
Loading…
Reference in New Issue
Block a user