@@ -29,11 +29,11 @@ func NewschemaCmd() *cobra.Command {
2929| country | Country | string | false |
3030| firstname | First Name | string | false |
3131+-----------+---------------+----------+---------+
32- +---------------+----------+- --------+
33- | CUSTOM FIELDS | TYPE | ENABLED |
34- +---------------+----------+- --------+
35- | MyCF | string | false |
36- +---------------+----------+- --------+
32+ +------------------- +-----------------------+---------+ --------+
33+ | CUSTOM FIELD NAME | CUSTOM FIELD DISPLAY | TYPE | ENABLED |
34+ +------------------- +-----------------------+---------+ --------+
35+ | cf_MyCF | MyCF | string | false |
36+ +------------------- +-----------------------+---------+ --------+
3737 ` ),
3838 RunE : func (cmd * cobra.Command , args []string ) error {
3939 return get ()
@@ -67,7 +67,12 @@ func get() error {
6767 if Type == "multi" {
6868 Type = "checkbox"
6969 }
70- data = append (data , []string {k , v .Display , Type , enabled })
70+ var displayName string
71+ displayName = activeRegField [k ].Display
72+ if displayName == "" {
73+ displayName = v .Display
74+ }
75+ data = append (data , []string {k , displayName , Type , enabled })
7176 }
7277 sort .SliceStable (data , func (i , j int ) bool {
7378 return data [i ][3 ] == "true"
@@ -86,18 +91,24 @@ func get() error {
8691 if len (customFields .Data ) > 0 {
8792 for _ , v := range customFields .Data {
8893 enabled := "false"
89- _ , ok := activeRegField ["cf_" + v .Display ]
94+ _ , ok := activeRegField ["cf_" + v .Key ]
9095 if ok {
9196 enabled = "true"
9297 }
93- Type := activeRegField ["cf_" + v .Display ].Type
94- cfTable .Append ([]string {v .Display , Type ,enabled })
98+ Type := activeRegField ["cf_" + v .Key ].Type
99+
100+ var displayName string
101+ displayName = activeRegField ["cf_" + v .Key ].Display
102+ if displayName == "" {
103+ displayName = v .Display
104+ }
105+ cfTable .Append ([]string {"cf_" + v .Key ,displayName , Type ,enabled })
95106 }
96107 } else {
97108 cfTable .Append ([]string {"No Custom Fields" })
98109 cfTable .SetCaption (true , "Use command `lr add custom-field` to add the Custom Field" )
99110 }
100- cfTable .SetHeader ([]string {"Custom Fields " , "Type" , "Enabled" })
111+ cfTable .SetHeader ([]string {"Custom Field Name" , "Custom Field Display " , "Type" , "Enabled" })
101112 cfTable .Render ()
102113
103114 return nil
0 commit comments