-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathapp_cat.go
41 lines (37 loc) · 853 Bytes
/
app_cat.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
package main
import (
"io"
"log"
"os"
)
func init() {
register(&Command{
group: "Application",
name: "app.cat",
help: "Get application instance file content",
params: []Param{
Param{name: "name", desc: "Application name"},
Param{name: "space", desc: "Space name"},
Param{name: "org", desc: "Organization name"},
Param{name: "instance", desc: "Application instance", defval: "0"},
Param{name: "file", desc: "Remote file"},
},
handle: app_cat,
})
}
func app_cat() {
target, err := c.SelectedTarget()
if err != nil {
log.Fatal(err)
}
// Get Application ID
app, err := target.AppFind(params["name"], params["space"], params["org"])
if err != nil {
log.Fatal(err)
}
reader, err := target.AppGet(app.Guid, params["instance"], params["file"])
if err != nil {
log.Fatal(err)
}
io.Copy(os.Stdout, reader)
}