MCPcopy
hub / github.com/kopia/kopia / appendFilesPolicyValue

Function appendFilesPolicyValue

cli/command_policy_show.go:167–213  ·  view source on GitHub ↗
(items []policyTableRow, p *policy.Policy, def *policy.Definition)

Source from the content-addressed store, hash-verified

165}
166
167func appendFilesPolicyValue(items []policyTableRow, p *policy.Policy, def *policy.Definition) []policyTableRow {
168 items = append(items,
169 policyTableRow{"Files policy:", "", ""},
170 policyTableRow{
171 " Ignore cache directories:",
172 boolToString(p.FilesPolicy.IgnoreCacheDirectories.OrDefault(true)),
173 definitionPointToString(p.Target(), def.FilesPolicy.IgnoreCacheDirectories),
174 })
175
176 if len(p.FilesPolicy.IgnoreRules) > 0 {
177 items = append(items, policyTableRow{
178 " Ignore rules:", "", definitionPointToString(p.Target(), def.FilesPolicy.IgnoreRules),
179 })
180 for _, rule := range p.FilesPolicy.IgnoreRules {
181 items = append(items, policyTableRow{" " + rule, "", ""})
182 }
183 } else {
184 items = append(items, policyTableRow{" No ignore rules:", "", ""})
185 }
186
187 if len(p.FilesPolicy.DotIgnoreFiles) > 0 {
188 items = append(items, policyTableRow{
189 " Read ignore rules from files:", "",
190 definitionPointToString(p.Target(), def.FilesPolicy.DotIgnoreFiles),
191 })
192
193 for _, dotFile := range p.FilesPolicy.DotIgnoreFiles {
194 items = append(items, policyTableRow{" " + dotFile, "", ""})
195 }
196 }
197
198 if maxSize := p.FilesPolicy.MaxFileSize; maxSize > 0 {
199 items = append(items, policyTableRow{
200 " Ignore files above:",
201 units.BytesString(maxSize),
202 definitionPointToString(p.Target(), def.FilesPolicy.MaxFileSize),
203 })
204 }
205
206 items = append(items, policyTableRow{
207 " Scan one filesystem only:",
208 boolToString(p.FilesPolicy.OneFileSystem.OrDefault(false)),
209 definitionPointToString(p.Target(), def.FilesPolicy.OneFileSystem),
210 })
211
212 return items
213}
214
215func appendErrorHandlingPolicyRows(rows []policyTableRow, p *policy.Policy, def *policy.Definition) []policyTableRow {
216 return append(rows,

Callers 1

printPolicyFunction · 0.85

Calls 5

BytesStringFunction · 0.92
boolToStringFunction · 0.85
definitionPointToStringFunction · 0.85
TargetMethod · 0.80
OrDefaultMethod · 0.45

Tested by

no test coverage detected