Update CLI output functions to show scope info and cleanup (#416)

This commit is contained in:
Jeff Mitchell authored and GitHub committed 2020-09-23 03:01:39 -04:00
1 parent 38ce9d9eac
commit 03436a73de
15 files changed
+222 -295

No files matched your search

+11 -9
View File
@@ -8,14 +8,11 @@ import (
)
func generateUserTableOutput(in *users.User) string {
var ret []string
nonAttributeMap := map[string]interface{}{
"ID": in.Id,
"Scope ID": in.Scope.Id,
"Version": in.Version,
"Created Time": in.CreatedTime.Local().Format(time.RFC3339),
"Updated Time": in.UpdatedTime.Local().Format(time.RFC3339),
"Created Time": in.CreatedTime.Local().Format(time.RFC1123),
"Updated Time": in.UpdatedTime.Local().Format(time.RFC1123),
}
if in.Name != "" {
@@ -25,11 +22,16 @@ func generateUserTableOutput(in *users.User) string {
nonAttributeMap["Description"] = in.Description
}
ret = append(ret, "", "User information:")
maxLength := base.MaxAttributesLength(nonAttributeMap, nil, nil)
ret = append(ret,
base.WrapMap(2, 0, nonAttributeMap),
)
ret := []string{
"",
"User information:",
base.WrapMap(2, maxLength+2, nonAttributeMap),
"",
" Scope:",
base.ScopeInfoForOutput(in.Scope, maxLength),
}
return base.WrapForHelpText(ret)
}