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
02099f44
Unverified
Commit
02099f44
authored
Aug 28, 2018
by
Clayton Coleman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reduce the minwidth of the cli table printer
For a few columns we want to have a smaller width and 10 is excessive.
parent
2548fb08
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
85 additions
and
85 deletions
+85
-85
get_contexts_test.go
pkg/kubectl/cmd/config/get_contexts_test.go
+2
-2
get_test.go
pkg/kubectl/cmd/get/get_test.go
+75
-75
customcolumn_test.go
pkg/printers/customcolumn_test.go
+7
-7
tabwriter.go
pkg/printers/tabwriter.go
+1
-1
No files found.
pkg/kubectl/cmd/config/get_contexts_test.go
View file @
02099f44
...
...
@@ -61,7 +61,7 @@ func TestGetContextsAllNoHeader(t *testing.T) {
names
:
[]
string
{},
noHeader
:
true
,
nameOnly
:
false
,
expectedOut
:
"*
shaker-context big-cluster blue-user saw-ns
\n
"
,
expectedOut
:
"* shaker-context big-cluster blue-user saw-ns
\n
"
,
}
test
.
run
(
t
)
}
...
...
@@ -171,7 +171,7 @@ func (test getContextsTest) run(t *testing.T) {
cmd
.
Run
(
cmd
,
test
.
names
)
if
len
(
test
.
expectedOut
)
!=
0
{
if
buf
.
String
()
!=
test
.
expectedOut
{
t
.
Errorf
(
"Expected
%v, but got %v
"
,
test
.
expectedOut
,
buf
.
String
())
t
.
Errorf
(
"Expected
\n
%s
\n
got
\n
%s
"
,
test
.
expectedOut
,
buf
.
String
())
}
return
}
...
...
pkg/kubectl/cmd/get/get_test.go
View file @
02099f44
This diff is collapsed.
Click to expand it.
pkg/printers/customcolumn_test.go
View file @
02099f44
...
...
@@ -286,8 +286,8 @@ bar
},
},
obj
:
&
v1
.
Pod
{
ObjectMeta
:
metav1
.
ObjectMeta
{
Name
:
"foo"
},
TypeMeta
:
metav1
.
TypeMeta
{
APIVersion
:
"baz"
}},
expectedOutput
:
`NAME
API_VERSION
foo
baz
expectedOutput
:
`NAME API_VERSION
foo baz
`
,
},
{
...
...
@@ -306,8 +306,8 @@ foo baz
},
},
obj
:
&
v1
.
Pod
{
ObjectMeta
:
metav1
.
ObjectMeta
{
Name
:
"foo"
},
TypeMeta
:
metav1
.
TypeMeta
{
APIVersion
:
"baz"
}},
expectedOutput
:
`NAME
API_VERSION NOT_FOUND
foo
baz <none>
expectedOutput
:
`NAME API_VERSION NOT_FOUND
foo baz <none>
`
,
},
}
...
...
@@ -349,9 +349,9 @@ func TestIndividualPrintObjOnExistingTabWriter(t *testing.T) {
{
ObjectMeta
:
metav1
.
ObjectMeta
{
Name
:
"foo"
,
Labels
:
map
[
string
]
string
{
"label1"
:
"foo"
,
"label2"
:
"foo"
}}},
{
ObjectMeta
:
metav1
.
ObjectMeta
{
Name
:
"bar"
,
Labels
:
map
[
string
]
string
{
"label1"
:
"bar"
,
"label2"
:
"bar"
}}},
}
expectedOutput
:=
`NAME
LONG COLUMN NAME LABEL 2
foo
foo foo
bar
bar bar
expectedOutput
:=
`NAME LONG COLUMN NAME LABEL 2
foo foo foo
bar bar bar
`
buffer
:=
&
bytes
.
Buffer
{}
...
...
pkg/printers/tabwriter.go
View file @
02099f44
...
...
@@ -22,7 +22,7 @@ import (
)
const
(
tabwriterMinWidth
=
10
tabwriterMinWidth
=
6
tabwriterWidth
=
4
tabwriterPadding
=
3
tabwriterPadChar
=
' '
...
...
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