mirror of
https://github.com/kopia/kopia.git
synced 2026-03-06 07:17:56 -05:00
cli: marked --ignore-{file,dir}-errors as enums, so that CLI parser enforces correct values
This commit is contained in:
@@ -13,6 +13,8 @@
|
||||
"github.com/kopia/kopia/snapshot/policy"
|
||||
)
|
||||
|
||||
var booleanEnumValues = []string{"true", "false", "inherit"}
|
||||
|
||||
var (
|
||||
policySetCommand = policyCommands.Command("set", "Set snapshot policy for a single directory, user@host or a global policy.")
|
||||
policySetTargets = policySetCommand.Arg("target", "Target of a policy ('global','user@host','@host') or a path").Strings()
|
||||
@@ -57,8 +59,8 @@
|
||||
policySetMaxFileSize = policySetCommand.Flag("max-file-size", "Exclude files above given size").PlaceHolder("N").String()
|
||||
|
||||
// Error handling behavior.
|
||||
policyIgnoreFileErrors = policySetCommand.Flag("ignore-file-errors", "Ignore errors reading files while traversing ('true', 'false', 'inherit')").String()
|
||||
policyIgnoreDirectoryErrors = policySetCommand.Flag("ignore-dir-errors", "Ignore errors reading directories while traversing ('true', 'false', 'inherit").String()
|
||||
policyIgnoreFileErrors = policySetCommand.Flag("ignore-file-errors", "Ignore errors reading files while traversing ('true', 'false', 'inherit')").Enum(booleanEnumValues...)
|
||||
policyIgnoreDirectoryErrors = policySetCommand.Flag("ignore-dir-errors", "Ignore errors reading directories while traversing ('true', 'false', 'inherit").Enum(booleanEnumValues...)
|
||||
|
||||
// General policy.
|
||||
policySetInherit = policySetCommand.Flag(inheritPolicyString, "Enable or disable inheriting policies from the parent").BoolList()
|
||||
|
||||
Reference in New Issue
Block a user