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
8a7f8bc0
Commit
8a7f8bc0
authored
Dec 19, 2017
by
Zhenguo Niu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move output and url checks under raw flag condition
parent
a0a69a35
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
8 deletions
+10
-8
get.go
pkg/kubectl/cmd/resource/get.go
+10
-8
No files found.
pkg/kubectl/cmd/resource/get.go
View file @
8a7f8bc0
...
...
@@ -212,14 +212,16 @@ func (options *GetOptions) Complete(f cmdutil.Factory, cmd *cobra.Command, args
// Validate checks the set of flags provided by the user.
func
(
options
*
GetOptions
)
Validate
(
cmd
*
cobra
.
Command
)
error
{
if
len
(
options
.
Raw
)
>
0
&&
(
options
.
Watch
||
options
.
WatchOnly
||
len
(
options
.
LabelSelector
)
>
0
||
options
.
Export
)
{
return
fmt
.
Errorf
(
"--raw may not be specified with other flags that filter the server request or alter the output"
)
}
if
len
(
cmdutil
.
GetFlagString
(
cmd
,
"output"
))
>
0
{
return
cmdutil
.
UsageErrorf
(
cmd
,
"--raw and --output are mutually exclusive"
)
}
if
_
,
err
:=
url
.
ParseRequestURI
(
options
.
Raw
);
err
!=
nil
{
return
cmdutil
.
UsageErrorf
(
cmd
,
"--raw must be a valid URL path: %v"
,
err
)
if
len
(
options
.
Raw
)
>
0
{
if
options
.
Watch
||
options
.
WatchOnly
||
len
(
options
.
LabelSelector
)
>
0
||
options
.
Export
{
return
fmt
.
Errorf
(
"--raw may not be specified with other flags that filter the server request or alter the output"
)
}
if
len
(
cmdutil
.
GetFlagString
(
cmd
,
"output"
))
>
0
{
return
cmdutil
.
UsageErrorf
(
cmd
,
"--raw and --output are mutually exclusive"
)
}
if
_
,
err
:=
url
.
ParseRequestURI
(
options
.
Raw
);
err
!=
nil
{
return
cmdutil
.
UsageErrorf
(
cmd
,
"--raw must be a valid URL path: %v"
,
err
)
}
}
if
cmdutil
.
GetFlagBool
(
cmd
,
"show-labels"
)
{
outputOption
:=
cmd
.
Flags
()
.
Lookup
(
"output"
)
.
Value
.
String
()
...
...
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