-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathorg_detail.go
53 lines (45 loc) · 925 Bytes
/
org_detail.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
42
43
44
45
46
47
48
49
50
51
52
53
package main
import (
"log"
"os"
"text/template"
)
// space.use also sets org
func init() {
register(&Command{
group: "Organization",
name: "org.detail",
help: "Show organization detail",
params: []Param{Param{name: "org", desc: "Organization name"}},
handle: org_detail,
})
}
func org_detail() {
target, err := c.SelectedTarget()
if err != nil {
log.Fatal(err)
}
orgs, err := target.OrganizationsGet()
if err != nil {
log.Fatal(err)
}
i, err := OrgList(orgs).findOrg(params["org"])
if err != nil {
i, err = choose(OrgList(orgs))
if err != nil {
log.Fatal(err)
}
}
orgTmpl.Execute(os.Stdout, orgs[i])
return
}
var orgTmpl = template.Must(template.New("orgDetail").Parse(org))
const org = `
Organization: {{.Name}} ({{.Status}})
Spaces:
{{range .Spaces}} {{.Name}}
{{end}}
Domains:
{{range .Domains}} {{.Name}} ( spaces:{{range .Spaces}} {{.Name}} {{end}})
{{end}}
`