Skip to content

Commit 992945e

Browse files
authored
Merge pull request #6 from jianxiaoguo/master
feat(workflow-cli):add drycc resource cmd improvement
2 parents ecfadb7 + 38c0c3b commit 992945e

6 files changed

Lines changed: 13 additions & 9 deletions

File tree

cmd/resources.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import (
1111
)
1212

1313
// ResourcesCreate create a resource for the application
14-
func (d *DryccCmd) ResourcesCreate(appID, name string, plan string, params []string) error {
14+
func (d *DryccCmd) ResourcesCreate(appID, plan string, name string, params []string) error {
1515
s, appID, err := load(d.ConfigFile, appID)
1616

1717
if err != nil {
@@ -109,7 +109,7 @@ func (d *DryccCmd) ResourceDelete(appID, name string) error {
109109
}
110110

111111
// ResourcePut update a resource for the application
112-
func (d *DryccCmd) ResourcePut(appID, name string, plan string, params []string) error {
112+
func (d *DryccCmd) ResourcePut(appID, plan string, name string, params []string) error {
113113
s, appID, err := load(d.ConfigFile, appID)
114114

115115
if err != nil {
@@ -193,7 +193,7 @@ func printResources(d *DryccCmd, appID string, resources api.Resources, wOut io.
193193
fmt.Fprintf(wOut, "=== %s resources\n", appID)
194194

195195
for _, resource := range resources {
196-
fmt.Fprintf(wOut, "--- %s\t%s\n", resource.Name, resource.Plan)
196+
fmt.Fprintf(wOut, "%s\t%s\n", resource.Name, resource.Plan)
197197
}
198198
}
199199

cmd/resources_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ func TestResourcesCreate(t *testing.T) {
2929
w.Write([]byte("{}"))
3030
})
3131

32-
err = cmdr.ResourcesCreate("example-go", "mysql", "mysql:5.6", nil)
32+
err = cmdr.ResourcesCreate("example-go", "mysql:5.6", "mysql", nil)
3333
assert.NoErr(t, err)
3434

3535
assert.Equal(t, testutil.StripProgress(b.String()), "Creating mysql to example-go... done\n", "output")
@@ -73,7 +73,7 @@ func TestResourcesList(t *testing.T) {
7373
assert.NoErr(t, err)
7474

7575
assert.Equal(t, b.String(), `=== example-go resources
76-
--- mysql mysql:5.6
76+
mysql mysql:5.6
7777
`, "output")
7878
}
7979

@@ -159,7 +159,7 @@ func TestResourcePut(t *testing.T) {
159159
w.Write([]byte("{}"))
160160
})
161161

162-
err = cmdr.ResourcePut("example-go", "mysql", "mysql:5.7", nil)
162+
err = cmdr.ResourcePut("example-go", "mysql:5.7", "mysql", nil)
163163
assert.NoErr(t, err)
164164

165165
assert.Equal(t, testutil.StripProgress(b.String()), "Updating mysql to example-go... done\n", "output")

drycc.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,8 @@ Use 'git push drycc master' to deploy to an application.
164164
err = parser.Whitelist(argv, &cmdr)
165165
case "volumes":
166166
err = parser.Volumes(argv, &cmdr)
167+
case "resources":
168+
err = parser.Resources(argv, &cmdr)
167169
default:
168170
env := os.Environ()
169171

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ go 1.13
55
require (
66
github.com/arschles/assert v1.0.1-0.20191213221312-71f210f9375a
77
github.com/docopt/docopt-go v0.0.0-20180111231733-ee0de3bc6815
8-
github.com/drycc/controller-sdk-go v0.0.0-20200901021526-471d3aa9862b
8+
github.com/drycc/controller-sdk-go v0.0.0-20200910051502-0b84631ba397
99
github.com/drycc/pkg v0.0.0-20200811173146-1f2b2781a852
1010
github.com/olekukonko/tablewriter v0.0.4
1111
golang.org/x/crypto v0.0.0-20200728195943-123391ffb6de

go.sum

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ github.com/drycc/controller-sdk-go v0.0.0-20200813035713-e73ce53533e7 h1:8tlFlmR
3636
github.com/drycc/controller-sdk-go v0.0.0-20200813035713-e73ce53533e7/go.mod h1:mF8/kZ/E4oDHCtfUVS790Frm8oVzZkoCGCKYT2eWQro=
3737
github.com/drycc/controller-sdk-go v0.0.0-20200901021526-471d3aa9862b h1:scZpGVSBX32HcCQcqwGmH1TKuy1xEczyF0fDH0XP1xA=
3838
github.com/drycc/controller-sdk-go v0.0.0-20200901021526-471d3aa9862b/go.mod h1:mF8/kZ/E4oDHCtfUVS790Frm8oVzZkoCGCKYT2eWQro=
39+
github.com/drycc/controller-sdk-go v0.0.0-20200910051502-0b84631ba397 h1:MbpNwDOmS0+YxR0S8AsmygAj2qsOy9PjmLUzI76OhZs=
40+
github.com/drycc/controller-sdk-go v0.0.0-20200910051502-0b84631ba397/go.mod h1:mF8/kZ/E4oDHCtfUVS790Frm8oVzZkoCGCKYT2eWQro=
3941
github.com/drycc/pkg v0.0.0-20190129033019-bcdffff0fcb3 h1:QRAbL97/hJecXQzaSONMCiwt1JjBKAAMKK0qJW5sgIM=
4042
github.com/drycc/pkg v0.0.0-20190129033019-bcdffff0fcb3/go.mod h1:zNgTT6kuGZOKMIdSrjskIw5fctdbbszqiTPEt3ffxHw=
4143
github.com/drycc/pkg v0.0.0-20200811173146-1f2b2781a852 h1:OsWH7jrv2i32rkvHFuj3yVpGMR+A6heRge9tm01XR/U=

parser/resources.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ func resourcesCreate(argv []string, cmdr cmd.Commander) error {
5555
usage := `
5656
Create a resource for the application.
5757
58-
Usage: drycc resources:create <plan> <name> <param>=<value>... [options]
58+
Usage: drycc resources:create <plan> <name> [<param>=<value>...] [options]
5959
6060
Arguments:
6161
<plan>
@@ -148,7 +148,7 @@ func resourcePut(argv []string, cmdr cmd.Commander) error {
148148
usage := `
149149
update a resource from the application
150150
151-
Usage: drycc resources:update <plan> <name> <param>=<value>... [options]
151+
Usage: drycc resources:update <plan> <name> [<param>=<value>...] [options]
152152
153153
Arguments:
154154
<plan>

0 commit comments

Comments
 (0)