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
34f8707d
Commit
34f8707d
authored
Sep 13, 2016
by
Michelle Noorali
Committed by
GitHub
Sep 13, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1181 from michelleN/ref/check-args
ref(helm): refactor checkArgsLength method
parents
d13af53b
e50f9e6b
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
9 additions
and
8 deletions
+9
-8
helm.go
cmd/helm/helm.go
+3
-2
inspect.go
cmd/helm/inspect.go
+1
-1
install.go
cmd/helm/install.go
+1
-1
repo.go
cmd/helm/repo.go
+2
-2
rollback.go
cmd/helm/rollback.go
+1
-1
upgrade.go
cmd/helm/upgrade.go
+1
-1
No files found.
cmd/helm/helm.go
View file @
34f8707d
...
@@ -138,8 +138,9 @@ func teardown() {
...
@@ -138,8 +138,9 @@ func teardown() {
}
}
}
}
func
checkArgsLength
(
expectedNum
,
actualNum
int
,
requiredArgs
...
string
)
error
{
func
checkArgsLength
(
argsReceived
int
,
requiredArgs
...
string
)
error
{
if
actualNum
!=
expectedNum
{
expectedNum
:=
len
(
requiredArgs
)
if
argsReceived
!=
expectedNum
{
arg
:=
"arguments"
arg
:=
"arguments"
if
expectedNum
==
1
{
if
expectedNum
==
1
{
arg
=
"argument"
arg
=
"argument"
...
...
cmd/helm/inspect.go
View file @
34f8707d
...
@@ -70,7 +70,7 @@ func newInspectCmd(c helm.Interface, out io.Writer) *cobra.Command {
...
@@ -70,7 +70,7 @@ func newInspectCmd(c helm.Interface, out io.Writer) *cobra.Command {
Short
:
"inspect a chart"
,
Short
:
"inspect a chart"
,
Long
:
inspectDesc
,
Long
:
inspectDesc
,
RunE
:
func
(
cmd
*
cobra
.
Command
,
args
[]
string
)
error
{
RunE
:
func
(
cmd
*
cobra
.
Command
,
args
[]
string
)
error
{
if
err
:=
checkArgsLength
(
1
,
len
(
args
),
"chart name"
);
err
!=
nil
{
if
err
:=
checkArgsLength
(
len
(
args
),
"chart name"
);
err
!=
nil
{
return
err
return
err
}
}
cp
,
err
:=
locateChartPath
(
args
[
0
],
insp
.
verify
,
insp
.
keyring
)
cp
,
err
:=
locateChartPath
(
args
[
0
],
insp
.
verify
,
insp
.
keyring
)
...
...
cmd/helm/install.go
View file @
34f8707d
...
@@ -89,7 +89,7 @@ func newInstallCmd(c helm.Interface, out io.Writer) *cobra.Command {
...
@@ -89,7 +89,7 @@ func newInstallCmd(c helm.Interface, out io.Writer) *cobra.Command {
Long
:
installDesc
,
Long
:
installDesc
,
PersistentPreRunE
:
setupConnection
,
PersistentPreRunE
:
setupConnection
,
RunE
:
func
(
cmd
*
cobra
.
Command
,
args
[]
string
)
error
{
RunE
:
func
(
cmd
*
cobra
.
Command
,
args
[]
string
)
error
{
if
err
:=
checkArgsLength
(
1
,
len
(
args
),
"chart name"
);
err
!=
nil
{
if
err
:=
checkArgsLength
(
len
(
args
),
"chart name"
);
err
!=
nil
{
return
err
return
err
}
}
cp
,
err
:=
locateChartPath
(
args
[
0
],
inst
.
verify
,
inst
.
keyring
)
cp
,
err
:=
locateChartPath
(
args
[
0
],
inst
.
verify
,
inst
.
keyring
)
...
...
cmd/helm/repo.go
View file @
34f8707d
...
@@ -69,7 +69,7 @@ var repoIndexCmd = &cobra.Command{
...
@@ -69,7 +69,7 @@ var repoIndexCmd = &cobra.Command{
}
}
func
runRepoAdd
(
cmd
*
cobra
.
Command
,
args
[]
string
)
error
{
func
runRepoAdd
(
cmd
*
cobra
.
Command
,
args
[]
string
)
error
{
if
err
:=
checkArgsLength
(
2
,
len
(
args
),
"name for the chart repository"
,
"the url of the chart repository"
);
err
!=
nil
{
if
err
:=
checkArgsLength
(
len
(
args
),
"name for the chart repository"
,
"the url of the chart repository"
);
err
!=
nil
{
return
err
return
err
}
}
name
,
url
:=
args
[
0
],
args
[
1
]
name
,
url
:=
args
[
0
],
args
[
1
]
...
@@ -101,7 +101,7 @@ func runRepoList(cmd *cobra.Command, args []string) error {
...
@@ -101,7 +101,7 @@ func runRepoList(cmd *cobra.Command, args []string) error {
}
}
func
runRepoRemove
(
cmd
*
cobra
.
Command
,
args
[]
string
)
error
{
func
runRepoRemove
(
cmd
*
cobra
.
Command
,
args
[]
string
)
error
{
if
err
:=
checkArgsLength
(
1
,
len
(
args
),
"name of chart repository"
);
err
!=
nil
{
if
err
:=
checkArgsLength
(
len
(
args
),
"name of chart repository"
);
err
!=
nil
{
return
err
return
err
}
}
return
removeRepoLine
(
args
[
0
])
return
removeRepoLine
(
args
[
0
])
...
...
cmd/helm/rollback.go
View file @
34f8707d
...
@@ -52,7 +52,7 @@ func newRollbackCmd(c helm.Interface, out io.Writer) *cobra.Command {
...
@@ -52,7 +52,7 @@ func newRollbackCmd(c helm.Interface, out io.Writer) *cobra.Command {
Long
:
rollbackDesc
,
Long
:
rollbackDesc
,
PersistentPreRunE
:
setupConnection
,
PersistentPreRunE
:
setupConnection
,
RunE
:
func
(
cmd
*
cobra
.
Command
,
args
[]
string
)
error
{
RunE
:
func
(
cmd
*
cobra
.
Command
,
args
[]
string
)
error
{
if
err
:=
checkArgsLength
(
1
,
len
(
args
),
"release name"
);
err
!=
nil
{
if
err
:=
checkArgsLength
(
len
(
args
),
"release name"
);
err
!=
nil
{
return
err
return
err
}
}
rollback
.
client
=
ensureHelmClient
(
rollback
.
client
)
rollback
.
client
=
ensureHelmClient
(
rollback
.
client
)
...
...
cmd/helm/upgrade.go
View file @
34f8707d
...
@@ -64,7 +64,7 @@ func newUpgradeCmd(client helm.Interface, out io.Writer) *cobra.Command {
...
@@ -64,7 +64,7 @@ func newUpgradeCmd(client helm.Interface, out io.Writer) *cobra.Command {
Long
:
upgradeDesc
,
Long
:
upgradeDesc
,
PersistentPreRunE
:
setupConnection
,
PersistentPreRunE
:
setupConnection
,
RunE
:
func
(
cmd
*
cobra
.
Command
,
args
[]
string
)
error
{
RunE
:
func
(
cmd
*
cobra
.
Command
,
args
[]
string
)
error
{
if
err
:=
checkArgsLength
(
2
,
len
(
args
),
"release name,
chart path"
);
err
!=
nil
{
if
err
:=
checkArgsLength
(
len
(
args
),
"release name"
,
"
chart path"
);
err
!=
nil
{
return
err
return
err
}
}
...
...
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