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
41b84b7f
Commit
41b84b7f
authored
May 06, 2019
by
Sean Sullivan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Unexport PrintTable function
parent
b3a73f76
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
5 deletions
+6
-5
printers_test.go
pkg/printers/internalversion/printers_test.go
+0
-0
tableprinter.go
pkg/printers/tableprinter.go
+4
-4
table_conversion.go
test/e2e/apimachinery/table_conversion.go
+2
-1
No files found.
pkg/printers/internalversion/printers_test.go
View file @
41b84b7f
This diff is collapsed.
Click to expand it.
pkg/printers/tableprinter.go
View file @
41b84b7f
...
@@ -97,7 +97,7 @@ func (h *HumanReadablePrinter) PrintObj(obj runtime.Object, output io.Writer) er
...
@@ -97,7 +97,7 @@ func (h *HumanReadablePrinter) PrintObj(obj runtime.Object, output io.Writer) er
if
err
:=
decorateTable
(
table
,
localOptions
);
err
!=
nil
{
if
err
:=
decorateTable
(
table
,
localOptions
);
err
!=
nil
{
return
err
return
err
}
}
return
P
rintTable
(
table
,
output
,
localOptions
)
return
p
rintTable
(
table
,
output
,
localOptions
)
}
}
// Case 2: Parameter "obj" is not a table; search for a handler to print it.
// Case 2: Parameter "obj" is not a table; search for a handler to print it.
...
@@ -133,10 +133,10 @@ func (h *HumanReadablePrinter) PrintObj(obj runtime.Object, output io.Writer) er
...
@@ -133,10 +133,10 @@ func (h *HumanReadablePrinter) PrintObj(obj runtime.Object, output io.Writer) er
return
nil
return
nil
}
}
//
P
rintTable prints a table to the provided output respecting the filtering rules for options
//
p
rintTable prints a table to the provided output respecting the filtering rules for options
// for wide columns and filtered rows. It filters out rows that are Completed. You should call
// for wide columns and filtered rows. It filters out rows that are Completed. You should call
// decorateTable if you receive a table from a remote server before calling
P
rintTable.
// decorateTable if you receive a table from a remote server before calling
p
rintTable.
func
P
rintTable
(
table
*
metav1beta1
.
Table
,
output
io
.
Writer
,
options
PrintOptions
)
error
{
func
p
rintTable
(
table
*
metav1beta1
.
Table
,
output
io
.
Writer
,
options
PrintOptions
)
error
{
if
!
options
.
NoHeaders
{
if
!
options
.
NoHeaders
{
// avoid printing headers if we have no rows to display
// avoid printing headers if we have no rows to display
if
len
(
table
.
Rows
)
==
0
{
if
len
(
table
.
Rows
)
==
0
{
...
...
test/e2e/apimachinery/table_conversion.go
View file @
41b84b7f
...
@@ -165,7 +165,8 @@ var _ = SIGDescribe("Servers with support for Table transformation", func() {
...
@@ -165,7 +165,8 @@ var _ = SIGDescribe("Servers with support for Table transformation", func() {
func
printTable
(
table
*
metav1beta1
.
Table
)
string
{
func
printTable
(
table
*
metav1beta1
.
Table
)
string
{
buf
:=
&
bytes
.
Buffer
{}
buf
:=
&
bytes
.
Buffer
{}
tw
:=
tabwriter
.
NewWriter
(
buf
,
5
,
8
,
1
,
' '
,
0
)
tw
:=
tabwriter
.
NewWriter
(
buf
,
5
,
8
,
1
,
' '
,
0
)
err
:=
printers
.
PrintTable
(
table
,
tw
,
printers
.
PrintOptions
{})
printer
:=
printers
.
NewTablePrinter
(
printers
.
PrintOptions
{})
err
:=
printer
.
PrintObj
(
table
,
tw
)
gomega
.
Expect
(
err
)
.
NotTo
(
gomega
.
HaveOccurred
(),
"failed to print table: %+v"
,
table
)
gomega
.
Expect
(
err
)
.
NotTo
(
gomega
.
HaveOccurred
(),
"failed to print table: %+v"
,
table
)
tw
.
Flush
()
tw
.
Flush
()
return
buf
.
String
()
return
buf
.
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