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
f76a17ac
Commit
f76a17ac
authored
Jan 29, 2016
by
Adam Reese
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(list): add list command
parent
db9ab4aa
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
50 additions
and
7 deletions
+50
-7
helm.go
cmd/helm.go
+12
-7
list.go
cmd/list.go
+28
-0
client.go
dm/client.go
+10
-0
No files found.
cmd/helm.go
View file @
f76a17ac
...
@@ -17,6 +17,16 @@ func main() {
...
@@ -17,6 +17,16 @@ func main() {
app
.
Usage
=
`Deploy and manage packages.`
app
.
Usage
=
`Deploy and manage packages.`
app
.
Commands
=
commands
()
app
.
Commands
=
commands
()
// TODO: make better
app
.
Flags
=
[]
cli
.
Flag
{
cli
.
StringFlag
{
Name
:
"host,u"
,
Usage
:
"The URL of the DM server."
,
EnvVar
:
"HELM_HOST"
,
Value
:
"https://localhost:8181/FIXME_NOT_RIGHT"
,
},
}
app
.
Run
(
os
.
Args
)
app
.
Run
(
os
.
Args
)
}
}
...
@@ -89,7 +99,7 @@ func commands() []cli.Command {
...
@@ -89,7 +99,7 @@ func commands() []cli.Command {
d
.
Input
=
os
.
Stdin
d
.
Input
=
os
.
Stdin
}
}
if
err
:=
deploy
(
d
,
c
.
String
(
"host"
),
c
.
Bool
(
"dry-run"
));
err
!=
nil
{
if
err
:=
deploy
(
d
,
c
.
Global
String
(
"host"
),
c
.
Bool
(
"dry-run"
));
err
!=
nil
{
format
.
Error
(
"%s (Try running 'helm doctor')"
,
err
)
format
.
Error
(
"%s (Try running 'helm doctor')"
,
err
)
os
.
Exit
(
1
)
os
.
Exit
(
1
)
}
}
...
@@ -119,16 +129,11 @@ func commands() []cli.Command {
...
@@ -119,16 +129,11 @@ func commands() []cli.Command {
Usage
:
"The default repository"
,
Usage
:
"The default repository"
,
Value
:
"kubernetes/application-dm-templates"
,
Value
:
"kubernetes/application-dm-templates"
,
},
},
cli
.
StringFlag
{
Name
:
"host,u"
,
Usage
:
"The URL of the DM server."
,
EnvVar
:
"HELM_HOST"
,
Value
:
"https://localhost:8181/FIXME_NOT_RIGHT"
,
},
},
},
},
},
{
{
Name
:
"search"
,
Name
:
"search"
,
},
},
listCmd
(),
}
}
}
}
cmd/list.go
0 → 100644
View file @
f76a17ac
package
main
import
(
"os"
"github.com/codegangsta/cli"
"github.com/deis/helm-dm/dm"
"github.com/deis/helm-dm/format"
)
func
listCmd
()
cli
.
Command
{
return
cli
.
Command
{
Name
:
"list"
,
Usage
:
"Lists the deployments in the cluster"
,
Action
:
func
(
c
*
cli
.
Context
)
{
if
err
:=
list
(
c
.
GlobalString
(
"host"
));
err
!=
nil
{
format
.
Error
(
"%s (Is the cluster running?)"
,
err
)
os
.
Exit
(
1
)
}
},
}
}
func
list
(
host
string
)
error
{
client
:=
dm
.
NewClient
(
host
)
client
.
Protocol
=
"http"
return
client
.
ListDeployments
()
}
dm/client.go
View file @
f76a17ac
...
@@ -96,3 +96,13 @@ func (c *Client) callHttp(path, method, action string, reader io.ReadCloser) (st
...
@@ -96,3 +96,13 @@ func (c *Client) callHttp(path, method, action string, reader io.ReadCloser) (st
return
string
(
body
),
nil
return
string
(
body
),
nil
}
}
func
(
c
*
Client
)
ListDeployments
()
error
{
var
d
interface
{}
if
err
:=
c
.
CallService
(
"deployments"
,
"GET"
,
"foo"
,
&
d
,
nil
);
err
!=
nil
{
return
err
}
fmt
.
Printf
(
"%#v
\n
"
,
d
)
return
nil
}
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