]> Cypherpunks.ru repositories - goredo.git/blobdiff - cleanup.go
isModified check must only look at ifchanges
[goredo.git] / cleanup.go
index 61f028f2d56dc6d600a1146ff1ac7d640f5cef56..8c757aeebcf4c58d2b1e96ba5e93fa10e0c4b271 100644 (file)
@@ -34,9 +34,14 @@ const (
        CleanupTmp  = "tmp"
 )
 
-var (
-       DryRun = flag.Bool("dry-run", false, "do no delete files during cleanup, just show them")
-)
+var DryRun *bool
+
+func init() {
+       if CmdName() != CmdNameRedoCleanup {
+               return
+       }
+       DryRun = flag.Bool("n", false, "do no delete files during cleanup, just show them")
+}
 
 func redoDirClean(root, what string) error {
        root, err := filepath.Abs(root)
@@ -60,7 +65,8 @@ func redoDirClean(root, what string) error {
                        pth = cwdMustRel(root, fi.Name())
                        switch what {
                        case CleanupLog:
-                               if strings.HasSuffix(fi.Name(), LogSuffix) {
+                               if strings.HasSuffix(fi.Name(), LogSuffix) ||
+                                       strings.HasSuffix(fi.Name(), LogRecSuffix) {
                                        fmt.Println(pth)
                                        if !*DryRun {
                                                if err = os.Remove(pth); err != nil {