Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
898cbeb9
Commit
898cbeb9
authored
Sep 03, 2020
by
Brian Downs
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'upstream/master' into issue-112
parents
00831f9b
289ba8df
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
16 additions
and
15 deletions
+16
-15
root.go
pkg/cli/cmds/root.go
+1
-1
server.go
pkg/cli/cmds/server.go
+2
-0
parser.go
pkg/configfilearg/parser.go
+2
-6
parser_test.go
pkg/configfilearg/parser_test.go
+9
-8
data.yaml
pkg/configfilearg/testdata/data.yaml
+2
-0
No files found.
pkg/cli/cmds/root.go
View file @
898cbeb9
...
@@ -13,7 +13,7 @@ var (
...
@@ -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"
,
}
}
...
...
pkg/cli/cmds/server.go
View file @
898cbeb9
...
@@ -77,6 +77,8 @@ func NewServerCommand(action func(*cli.Context) error) cli.Command {
...
@@ -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
,
...
...
pkg/configfilearg/parser.go
View file @
898cbeb9
...
@@ -104,15 +104,11 @@ func readConfigFile(file string) (result []string, _ error) {
...
@@ -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
)
}
}
}
}
}
...
...
pkg/configfilearg/parser_test.go
View file @
898cbeb9
...
@@ -150,14 +150,15 @@ func TestConfigFile(t *testing.T) {
...
@@ -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
{
...
...
pkg/configfilearg/testdata/data.yaml
View file @
898cbeb9
...
@@ -6,4 +6,5 @@ a-slice:
...
@@ -6,4 +6,5 @@ a-slice:
-
three
-
three
isempty
:
isempty
:
c
:
b
c
:
b
isfalse
:
false
islast
:
true
islast
:
true
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment