MCPcopy
hub / github.com/cortexlabs/cortex / mergeOptions

Function mergeOptions

pkg/lib/table/key_value.go:100–138  ·  view source on GitHub ↗
(options ...*KeyValuePairOpts)

Source from the content-addressed store, hash-verified

98}
99
100func mergeOptions(options ...*KeyValuePairOpts) KeyValuePairOpts {
101 mergedOpts := KeyValuePairOpts{}
102
103 for _, opt := range options {
104 if opt != nil && opt.Delimiter != nil {
105 mergedOpts.Delimiter = opt.Delimiter
106 }
107 if opt != nil && opt.NumSpaces != nil {
108 mergedOpts.NumSpaces = opt.NumSpaces
109 }
110 if opt != nil && opt.RightJustify != nil {
111 mergedOpts.RightJustify = opt.RightJustify
112 }
113 if opt != nil && opt.BoldFirstLine != nil {
114 mergedOpts.BoldFirstLine = opt.BoldFirstLine
115 }
116 if opt != nil && opt.BoldKeys != nil {
117 mergedOpts.BoldKeys = opt.BoldKeys
118 }
119 }
120
121 if mergedOpts.Delimiter == nil {
122 mergedOpts.Delimiter = pointer.String(":")
123 }
124 if mergedOpts.NumSpaces == nil {
125 mergedOpts.NumSpaces = pointer.Int(1)
126 }
127 if mergedOpts.RightJustify == nil {
128 mergedOpts.RightJustify = pointer.Bool(false)
129 }
130 if mergedOpts.BoldFirstLine == nil {
131 mergedOpts.BoldFirstLine = pointer.Bool(false)
132 }
133 if mergedOpts.BoldKeys == nil {
134 mergedOpts.BoldKeys = pointer.Bool(false)
135 }
136
137 return mergedOpts
138}

Callers 1

StringMethod · 0.85

Calls 3

StringFunction · 0.92
IntFunction · 0.92
BoolFunction · 0.92

Tested by

no test coverage detected