From b93f36c178a896a775ad173a7f1371927723ec42 Mon Sep 17 00:00:00 2001 From: Krystian Panek Date: Wed, 10 Apr 2024 12:11:02 +0200 Subject: [PATCH] Minors --- pkg/content/content.go | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/pkg/content/content.go b/pkg/content/content.go index f192c738..55f39b83 100644 --- a/pkg/content/content.go +++ b/pkg/content/content.go @@ -77,9 +77,9 @@ func (c Manager) AfterPullFile(path string) error { func (c Manager) CleanDir(root string) error { if !pathx.Exists(root) { - return fmt.Errorf("cannot clean directory as it does not exist: %s", root) + return fmt.Errorf("cannot clean directory as it does not exist '%s'", root) } - log.Infof("cleaning directory %s", root) + log.Infof("cleaning directory '%s'", root) if err := c.cleanDotContents(root); err != nil { return err } @@ -92,7 +92,7 @@ func (c Manager) CleanDir(root string) error { if err := deleteEmptyDirs(root); err != nil { return err } - log.Infof("cleaned %s directory", root) + log.Infof("cleaned directory '%s'", root) return nil } @@ -100,7 +100,7 @@ func (c Manager) CleanFile(path string) error { if !pathx.Exists(path) { return fmt.Errorf("cannot clean file as it does not exist: %s", path) } - log.Infof("cleaning file %s", path) + log.Infof("cleaning file '%s'", path) if err := c.cleanDotContentFile(path); err != nil { return err } @@ -110,7 +110,7 @@ func (c Manager) CleanFile(path string) error { if err := deleteEmptyDirs(filepath.Dir(path)); err != nil { return err } - log.Infof("cleaned %s file", path) + log.Infof("cleaned file '%s'", path) return nil } @@ -149,7 +149,7 @@ func (c Manager) cleanDotContentFile(path string) error { return nil } - log.Debugf("cleaning dot content file %s", path) + log.Infof("cleaning dot content file '%s'", path) inputLines, err := readLines(path) if err != nil { return err @@ -248,9 +248,9 @@ func (c Manager) flattenFile(path string) error { dest := filepath.Dir(path) + ".xml" if pathx.Exists(dest) { - log.Debugf("flattening file (override): %s", path) + log.Infof("flattening file (override) '%s'", path) } else { - log.Debugf("flattening file: %s", path) + log.Infof("flattening file '%s'", path) } return os.Rename(path, dest) } @@ -279,7 +279,7 @@ func deleteDir(dir string) error { if !pathx.Exists(dir) { return nil } - log.Debugf("deleting dir %s", dir) + log.Infof("deleting dir '%s'", dir) return os.RemoveAll(dir) } @@ -287,7 +287,7 @@ func deleteFile(path string, allowedFunc func() bool) error { if !pathx.Exists(path) || allowedFunc != nil && !allowedFunc() { return nil } - log.Debugf("deleting file %s", path) + log.Infof("deleting file '%s'", path) return os.Remove(path) } @@ -308,7 +308,7 @@ func deleteEmptyDirs(root string) error { return err } if len(entries) == 0 { - log.Debugf("deleting empty directory %s", root) + log.Infof("deleting empty directory '%s'", root) if err = os.Remove(root); err != nil { return err } @@ -320,7 +320,7 @@ func (c Manager) doParentsBackup(root string) error { return eachParentFiles(root, func(parent string) error { return eachFilesInDir(parent, func(path string) error { if !strings.HasSuffix(path, ParentsBackupSuffix) { - log.Debugf("doing backup of parent file: %s", path) + log.Infof("doing backup of parent file '%s'", path) if err := c.backupFile(path); err != nil { return err } @@ -334,7 +334,7 @@ func (c Manager) doSiblingsBackup(file string) error { dir := filepath.Dir(file) return eachFilesInDir(dir, func(path string) error { if path != file && !strings.HasSuffix(path, ParentsBackupSuffix) { - log.Debugf("doing backup of file: %s", path) + log.Infof("doing backup of file '%s'", path) if err := c.backupFile(path); err != nil { return err } @@ -367,7 +367,7 @@ func (c Manager) undoParentsBackup(root string) error { return eachFilesInDir(parent, func(path string) error { if strings.HasSuffix(path, ParentsBackupSuffix) { origin := strings.TrimSuffix(path, ParentsBackupSuffix) - log.Debugf("undoing backup of parent file: %s", path) + log.Infof("undoing backup of parent file '%s'", path) return os.Rename(path, origin) } return nil @@ -380,7 +380,7 @@ func (c Manager) undoSiblingBackup(path string) error { return eachFilesInDir(dir, func(path string) error { if strings.HasSuffix(path, ParentsBackupSuffix) { origin := strings.TrimSuffix(path, ParentsBackupSuffix) - log.Debugf("undoing backup of file: %s", path) + log.Infof("undoing backup of file '%s'", path) return os.Rename(path, origin) } else if strings.HasSuffix(path, ParentsBackupDirIndicator) { return deleteFile(path, nil)