MCPcopy
hub / github.com/kopia/kopia / appendActionsPolicyRows

Function appendActionsPolicyRows

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

Source from the content-addressed store, hash-verified

415}
416
417func appendActionsPolicyRows(rows []policyTableRow, p *policy.Policy, def *policy.Definition) []policyTableRow {
418 var anyActions bool
419
420 if h := p.Actions.BeforeSnapshotRoot; h != nil {
421 rows = append(rows,
422 policyTableRow{"Run command before snapshot root:", "", definitionPointToString(p.Target(), def.Actions.BeforeSnapshotRoot)})
423 rows = appendActionCommandRows(rows, h)
424
425 anyActions = true
426 }
427
428 if h := p.Actions.AfterSnapshotRoot; h != nil {
429 rows = append(rows, policyTableRow{"Run command after snapshot root:", "", definitionPointToString(p.Target(), def.Actions.AfterSnapshotRoot)})
430 rows = appendActionCommandRows(rows, h)
431
432 anyActions = true
433 }
434
435 if h := p.Actions.BeforeFolder; h != nil {
436 rows = append(rows, policyTableRow{"Run command before this folder:", "", "(non-inheritable)"})
437 rows = appendActionCommandRows(rows, h)
438
439 anyActions = true
440 }
441
442 if h := p.Actions.AfterFolder; h != nil {
443 rows = append(rows, policyTableRow{"Run command after this folder:", "", "(non-inheritable)"})
444 rows = appendActionCommandRows(rows, h)
445
446 anyActions = true
447 }
448
449 if !anyActions {
450 rows = append(rows, policyTableRow{"No actions defined.", "", ""})
451 }
452
453 return rows
454}
455
456func appendActionCommandRows(rows []policyTableRow, h *policy.ActionCommand) []policyTableRow {
457 if h.Script != "" {

Callers 1

printPolicyFunction · 0.85

Calls 3

definitionPointToStringFunction · 0.85
appendActionCommandRowsFunction · 0.85
TargetMethod · 0.80

Tested by

no test coverage detected