From 698488324bd57f013fb46072cecaa786d04690e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20H=C3=A4felfinger?= Date: Tue, 22 Oct 2019 22:40:04 +0200 Subject: [PATCH] typo, logs, modules, todo --- go.sum | 1 + internal/app/app.go | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/go.sum b/go.sum index 6435db2..5e679a1 100644 --- a/go.sum +++ b/go.sum @@ -1,4 +1,5 @@ github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/konsorten/go-windows-terminal-sequences v1.0.1 h1:mweAR1A6xJ3oS2pRaGiHgQ4OO8tzTaLawm8vnODuwDk= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/sirupsen/logrus v1.4.2 h1:SPIRibHv4MatM3XXNO2BJeFLZwZ2LvZgfQ5+UNI2im4= diff --git a/internal/app/app.go b/internal/app/app.go index 2131674..4caff23 100644 --- a/internal/app/app.go +++ b/internal/app/app.go @@ -32,15 +32,17 @@ func Run() { logErrorAndExit(err, 2) } - filesWithMissingSidecar := getJpesWithoutRawSideCar(jpgFiles) + filesWithMissingSidecar := getJpegsWithoutRawSideCar(jpgFiles) logrus.Infof("Found %d of %d images to delete in %s", len(filesWithMissingSidecar), len(jpgFiles), imagesRootFolder) + //todo: this check needs to be performed by each directory and if true, skip the directory but not all if len(jpgFiles) == len(filesWithMissingSidecar) { logrus.Warnf("Did not find any sidecar files in %s. Are you sure this is the right path to look for jpgs without raw sidecars? Cancelling executing!", imagesRootFolder) logErrorAndExit(errors.New("Total files of jpegs and missing sidecars are the same, cancelling!"), 3) } if !(*dryRun) { + logrus.Infof("Starting to delete %d files...", len(filesWithMissingSidecar)) deleteFiles(filesWithMissingSidecar) } else { logrus.Warnln("Skipping delete of images as flag dryRun is set to true!") @@ -63,7 +65,7 @@ func logErrorAndExit(err error, exitCode int) { os.Exit(exitCode) } -func getJpesWithoutRawSideCar(jpgFiles []string) []string { +func getJpegsWithoutRawSideCar(jpgFiles []string) []string { var filesWithMissingSidecar []string for _, jpgFile := range jpgFiles { dir, fileName := filepath.Split(jpgFile)