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
e50f9e6b
Commit
e50f9e6b
authored
Sep 12, 2016
by
Michelle Noorali
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ref(helm): refactor checkArgsLength method
parent
60b41888
Hide 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 @
e50f9e6b
...
...
@@ -138,8 +138,9 @@ func teardown() {
}
}
func
checkArgsLength
(
expectedNum
,
actualNum
int
,
requiredArgs
...
string
)
error
{
if
actualNum
!=
expectedNum
{
func
checkArgsLength
(
argsReceived
int
,
requiredArgs
...
string
)
error
{
expectedNum
:=
len
(
requiredArgs
)
if
argsReceived
!=
expectedNum
{
arg
:=
"arguments"
if
expectedNum
==
1
{
arg
=
"argument"
...
...
cmd/helm/inspect.go
View file @
e50f9e6b
...
...
@@ -70,7 +70,7 @@ func newInspectCmd(c helm.Interface, out io.Writer) *cobra.Command {
Short
:
"inspect a chart"
,
Long
:
inspectDesc
,
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
}
cp
,
err
:=
locateChartPath
(
args
[
0
],
insp
.
verify
,
insp
.
keyring
)
...
...
cmd/helm/install.go
View file @
e50f9e6b
...
...
@@ -89,7 +89,7 @@ func newInstallCmd(c helm.Interface, out io.Writer) *cobra.Command {
Long
:
installDesc
,
PersistentPreRunE
:
setupConnection
,
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
}
cp
,
err
:=
locateChartPath
(
args
[
0
],
inst
.
verify
,
inst
.
keyring
)
...
...
cmd/helm/repo.go
View file @
e50f9e6b
...
...
@@ -69,7 +69,7 @@ var repoIndexCmd = &cobra.Command{
}
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
}
name
,
url
:=
args
[
0
],
args
[
1
]
...
...
@@ -101,7 +101,7 @@ func runRepoList(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
removeRepoLine
(
args
[
0
])
...
...
cmd/helm/rollback.go
View file @
e50f9e6b
...
...
@@ -52,7 +52,7 @@ func newRollbackCmd(c helm.Interface, out io.Writer) *cobra.Command {
Long
:
rollbackDesc
,
PersistentPreRunE
:
setupConnection
,
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
}
rollback
.
client
=
ensureHelmClient
(
rollback
.
client
)
...
...
cmd/helm/upgrade.go
View file @
e50f9e6b
...
...
@@ -64,7 +64,7 @@ func newUpgradeCmd(client helm.Interface, out io.Writer) *cobra.Command {
Long
:
upgradeDesc
,
PersistentPreRunE
:
setupConnection
,
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
}
...
...
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