Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
H
helm3
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
helm3
Commits
7a65f747
Commit
7a65f747
authored
Apr 23, 2018
by
Marat Garafutdinov
Committed by
Matthew Fisher
Apr 23, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add --col-width to `helm search` (#3949)
* add customizeable --col-width * make docs. whitespacing
parent
6d25f67b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
4 deletions
+7
-4
search.go
cmd/helm/search.go
+5
-3
helm_search.md
docs/helm/helm_search.md
+2
-1
No files found.
cmd/helm/search.go
View file @
7a65f747
...
@@ -47,6 +47,7 @@ type searchCmd struct {
...
@@ -47,6 +47,7 @@ type searchCmd struct {
versions
bool
versions
bool
regexp
bool
regexp
bool
version
string
version
string
colWidth
uint
}
}
func
newSearchCmd
(
out
io
.
Writer
)
*
cobra
.
Command
{
func
newSearchCmd
(
out
io
.
Writer
)
*
cobra
.
Command
{
...
@@ -66,6 +67,7 @@ func newSearchCmd(out io.Writer) *cobra.Command {
...
@@ -66,6 +67,7 @@ func newSearchCmd(out io.Writer) *cobra.Command {
f
.
BoolVarP
(
&
sc
.
regexp
,
"regexp"
,
"r"
,
false
,
"use regular expressions for searching"
)
f
.
BoolVarP
(
&
sc
.
regexp
,
"regexp"
,
"r"
,
false
,
"use regular expressions for searching"
)
f
.
BoolVarP
(
&
sc
.
versions
,
"versions"
,
"l"
,
false
,
"show the long listing, with each version of each chart on its own line"
)
f
.
BoolVarP
(
&
sc
.
versions
,
"versions"
,
"l"
,
false
,
"show the long listing, with each version of each chart on its own line"
)
f
.
StringVarP
(
&
sc
.
version
,
"version"
,
"v"
,
""
,
"search using semantic versioning constraints"
)
f
.
StringVarP
(
&
sc
.
version
,
"version"
,
"v"
,
""
,
"search using semantic versioning constraints"
)
f
.
UintVar
(
&
sc
.
colWidth
,
"col-width"
,
60
,
"specifies the max column width of output"
)
return
cmd
return
cmd
}
}
...
@@ -93,7 +95,7 @@ func (s *searchCmd) run(args []string) error {
...
@@ -93,7 +95,7 @@ func (s *searchCmd) run(args []string) error {
return
err
return
err
}
}
fmt
.
Fprintln
(
s
.
out
,
s
.
formatSearchResults
(
data
))
fmt
.
Fprintln
(
s
.
out
,
s
.
formatSearchResults
(
data
,
s
.
colWidth
))
return
nil
return
nil
}
}
...
@@ -126,12 +128,12 @@ func (s *searchCmd) applyConstraint(res []*search.Result) ([]*search.Result, err
...
@@ -126,12 +128,12 @@ func (s *searchCmd) applyConstraint(res []*search.Result) ([]*search.Result, err
return
data
,
nil
return
data
,
nil
}
}
func
(
s
*
searchCmd
)
formatSearchResults
(
res
[]
*
search
.
Result
)
string
{
func
(
s
*
searchCmd
)
formatSearchResults
(
res
[]
*
search
.
Result
,
colWidth
uint
)
string
{
if
len
(
res
)
==
0
{
if
len
(
res
)
==
0
{
return
"No results found"
return
"No results found"
}
}
table
:=
uitable
.
New
()
table
:=
uitable
.
New
()
table
.
MaxColWidth
=
50
table
.
MaxColWidth
=
colWidth
table
.
AddRow
(
"NAME"
,
"CHART VERSION"
,
"APP VERSION"
,
"DESCRIPTION"
)
table
.
AddRow
(
"NAME"
,
"CHART VERSION"
,
"APP VERSION"
,
"DESCRIPTION"
)
for
_
,
r
:=
range
res
{
for
_
,
r
:=
range
res
{
table
.
AddRow
(
r
.
Name
,
r
.
Chart
.
Version
,
r
.
Chart
.
AppVersion
,
r
.
Chart
.
Description
)
table
.
AddRow
(
r
.
Name
,
r
.
Chart
.
Version
,
r
.
Chart
.
AppVersion
,
r
.
Chart
.
Description
)
...
...
docs/helm/helm_search.md
View file @
7a65f747
...
@@ -19,6 +19,7 @@ helm search [keyword]
...
@@ -19,6 +19,7 @@ helm search [keyword]
### Options
### Options
```
```
--col-width uint specifies the max column width of output (default 60)
-r, --regexp use regular expressions for searching
-r, --regexp use regular expressions for searching
-v, --version string search using semantic versioning constraints
-v, --version string search using semantic versioning constraints
-l, --versions show the long listing, with each version of each chart on its own line
-l, --versions show the long listing, with each version of each chart on its own line
...
@@ -38,4 +39,4 @@ helm search [keyword]
...
@@ -38,4 +39,4 @@ helm search [keyword]
### SEE ALSO
### SEE ALSO
*
[
helm
](
helm.md
)
- The Helm package manager for Kubernetes.
*
[
helm
](
helm.md
)
- The Helm package manager for Kubernetes.
###### Auto generated by spf13/cobra on
8-Ma
r-2018
###### Auto generated by spf13/cobra on
23-Ap
r-2018
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