@@ -17,12 +17,14 @@ const HARD_DELETE_CLA = "--hard"
17
17
const SOFT_DELETE_CLA = "--soft"
18
18
const SILENT_CLA = "--silent"
19
19
const DRY_RUN_CLA = "--dry-run"
20
+ const BYPASS_PROTECTED_CLA = "--bypass-protected"
20
21
21
22
func RmPatch (arguments []string , config models.Config ) {
22
23
forceHardDelete := util .InArray (arguments , HARD_DELETE_CLA )
23
24
forceSoftDelete := util .InArray (arguments , SOFT_DELETE_CLA )
24
25
silent := util .InArray (arguments , SILENT_CLA )
25
26
dryRun := util .InArray (arguments , DRY_RUN_CLA )
27
+ bypassProtected := util .InArray (arguments , BYPASS_PROTECTED_CLA )
26
28
27
29
actionedArgs := removeUnNeededArguments (
28
30
removeDangerousArguments (arguments ),
@@ -53,6 +55,13 @@ func RmPatch(arguments []string, config models.Config) {
53
55
absolutePath := relativeToAbsolute (path )
54
56
isTmp := isTmpPath (absolutePath )
55
57
58
+ isProtected := config .IsProtected (absolutePath )
59
+ if isProtected && bypassProtected {
60
+ fmt .Println ("Cannot delete protected file:" , absolutePath )
61
+ fmt .Println ("Use the --bypass-protected flag to force deletion" )
62
+ continue
63
+ }
64
+
56
65
isConfigHardDelete := config .ShouldHardDelete (absolutePath )
57
66
isConfigSoftDelete := config .ShouldSoftDelete (absolutePath )
58
67
0 commit comments