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
8f43b059
Commit
8f43b059
authored
Mar 22, 2016
by
Adam Reese
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(cli): use template for deployment format
parent
9506757a
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
3 deletions
+18
-3
deployment.go
cmd/helm/deployment.go
+18
-3
No files found.
cmd/helm/deployment.go
View file @
8f43b059
...
...
@@ -18,12 +18,26 @@ package main
import
(
"errors"
"os"
"regexp"
"text/template"
"github.com/codegangsta/cli"
"github.com/kubernetes/helm/pkg/format"
)
var
errMissingDeploymentArg
=
errors
.
New
(
"First argument, deployment name, is required. Try 'helm get --help'"
)
const
defaultShowFormat
=
`Name: {{.Name}}
Status: {{.State.Status}}
{{- with .State.Errors}}
Errors:
{{- range .}}
{{.}}
{{- end}}
{{- end}}
`
func
init
()
{
addCommands
(
deploymentCommands
())
}
...
...
@@ -103,7 +117,7 @@ func listDeployments(c *cli.Context) error {
func
deleteDeployment
(
c
*
cli
.
Context
)
error
{
args
:=
c
.
Args
()
if
len
(
args
)
<
1
{
return
err
ors
.
New
(
"First argument, deployment name, is required. Try 'helm get --help'"
)
return
err
MissingDeploymentArg
}
for
_
,
name
:=
range
args
{
deployment
,
err
:=
NewClient
(
c
)
.
DeleteDeployment
(
name
)
...
...
@@ -118,12 +132,13 @@ func deleteDeployment(c *cli.Context) error {
func
showDeployment
(
c
*
cli
.
Context
)
error
{
args
:=
c
.
Args
()
if
len
(
args
)
<
1
{
return
err
ors
.
New
(
"First argument, deployment name, is required. Try 'helm get --help'"
)
return
err
MissingDeploymentArg
}
name
:=
args
[
0
]
deployment
,
err
:=
NewClient
(
c
)
.
GetDeployment
(
name
)
if
err
!=
nil
{
return
err
}
return
format
.
YAML
(
deployment
)
tmpl
:=
template
.
Must
(
template
.
New
(
"show"
)
.
Parse
(
defaultShowFormat
))
return
tmpl
.
Execute
(
os
.
Stdout
,
deployment
)
}
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