Add profile name to group show
This commit is contained in:
parent
b6be793f8c
commit
3403eb19a5
1 changed files with 21 additions and 9 deletions
|
@ -83,18 +83,30 @@ var (
|
||||||
}
|
}
|
||||||
fmt.Println("Members")
|
fmt.Println("Members")
|
||||||
|
|
||||||
membere164s := make(map[string]string)
|
// membere164s := make(map[string]string)
|
||||||
for _, member := range group.Members {
|
// for _, member := range group.Members {
|
||||||
if member.Number == "" {
|
// if member.Number == "" {
|
||||||
continue
|
// continue
|
||||||
}
|
// }
|
||||||
membere164s[member.UUID] = member.Number
|
// membere164s[member.UUID] = member.Number
|
||||||
}
|
// }
|
||||||
|
|
||||||
t := table.NewWriter()
|
t := table.NewWriter()
|
||||||
t.AppendHeader(table.Row{"Number", "UUID", "Role"})
|
t.AppendHeader(table.Row{"Number", "UUID", "Name", "Role"})
|
||||||
for _, member := range group.MemberDetail {
|
for _, member := range group.MemberDetail {
|
||||||
t.AppendRow(table.Row{membere164s[member.UUID], member.UUID, member.Role})
|
req := v1.GetProfileRequest{
|
||||||
|
Account: account,
|
||||||
|
Address: &v1.JsonAddress{UUID: member.UUID},
|
||||||
|
Async: true,
|
||||||
|
}
|
||||||
|
e164 := ""
|
||||||
|
profile, err := req.Submit(common.Signald)
|
||||||
|
if err != nil {
|
||||||
|
log.Println("error getting profile: ", err)
|
||||||
|
} else {
|
||||||
|
e164 = profile.Address.Number
|
||||||
|
}
|
||||||
|
t.AppendRow(table.Row{e164, member.UUID, profile.ProfileName, member.Role})
|
||||||
}
|
}
|
||||||
t.SetOutputMirror(os.Stdout)
|
t.SetOutputMirror(os.Stdout)
|
||||||
common.StylizeTable(t)
|
common.StylizeTable(t)
|
||||||
|
|
Loading…
Reference in a new issue