Files
threshold/internal/cmd/commands/users/funcs.go
T

35 lines
746 B
Go
Raw Normal View History

package users
import (
"time"
"github.com/hashicorp/boundary/api/users"
"github.com/hashicorp/boundary/internal/cmd/base"
)
func generateUserTableOutput(in *users.User) string {
var ret []string
2020-08-28 01:28:26 -04:00
nonAttributeMap := map[string]interface{}{
"ID": in.Id,
"Scope ID": in.Scope.Id,
2020-08-28 01:28:26 -04:00
"Version": in.Version,
"Created Time": in.CreatedTime.Local().Format(time.RFC3339),
"Updated Time": in.UpdatedTime.Local().Format(time.RFC3339),
}
2020-08-28 01:28:26 -04:00
if in.Name != "" {
2020-08-28 01:28:26 -04:00
nonAttributeMap["Name"] = in.Name
}
if in.Description != "" {
2020-08-28 01:28:26 -04:00
nonAttributeMap["Description"] = in.Description
}
2020-08-28 01:28:26 -04:00
ret = append(ret, "", "User information:")
ret = append(ret,
base.WrapMap(2, 0, nonAttributeMap),
)
return base.WrapForHelpText(ret)
}