From 19c2e616fc767ccd95dbed658db086fb1aabd04d Mon Sep 17 00:00:00 2001 From: Seednode Date: Thu, 28 Sep 2023 07:29:33 -0500 Subject: [PATCH] Rework verbose output for visual consistency --- cmd/files.go | 43 +++++++++++++++++++++++-------------------- cmd/root.go | 2 +- cmd/web.go | 7 +++++++ 3 files changed, 31 insertions(+), 21 deletions(-) diff --git a/cmd/files.go b/cmd/files.go index 5277904..7c6ff2e 100644 --- a/cmd/files.go +++ b/cmd/files.go @@ -498,9 +498,6 @@ func normalizePath(path string) (string, error) { func validatePaths(args []string, formats *types.Types) ([]string, error) { var paths []string - var pathList strings.Builder - pathList.WriteString("Paths:\n") - for i := 0; i < len(args); i++ { path, err := normalizePath(args[i]) if err != nil { @@ -514,28 +511,34 @@ func validatePaths(args []string, formats *types.Types) ([]string, error) { return nil, err } - var addPath = false - switch { case pathMatches && hasSupportedFiles: - pathList.WriteString(fmt.Sprintf("%s\n", args[i])) - addPath = true - case !pathMatches && hasSupportedFiles: - pathList.WriteString(fmt.Sprintf("%s (resolved to %s)\n", args[i], path)) - addPath = true - case pathMatches && !hasSupportedFiles: - pathList.WriteString(fmt.Sprintf("%s [No supported files found]\n", args[i])) - case !pathMatches && !hasSupportedFiles: - pathList.WriteString(fmt.Sprintf("%s (resolved to %s) [No supported files found]\n", args[i], path)) - } + fmt.Printf("%s | PATHS: Added %s\n", + time.Now().Format(logDate), + args[i], + ) - if addPath { paths = append(paths, path) - } - } + case !pathMatches && hasSupportedFiles: + fmt.Printf("%s | PATHS: Added %s [resolved to %s]\n", + time.Now().Format(logDate), + args[i], + path, + ) - if len(paths) > 0 { - fmt.Println(pathList.String()) + paths = append(paths, path) + case pathMatches && !hasSupportedFiles: + fmt.Printf("%s | PATHS: Skipped %s (No supported files found)\n", + time.Now().Format(logDate), + args[i], + ) + case !pathMatches && !hasSupportedFiles: + fmt.Printf("%s | PATHS: Skipped %s [resolved to %s] (No supported files found)\n", + time.Now().Format(logDate), + args[i], + path, + ) + } } return paths, nil diff --git a/cmd/root.go b/cmd/root.go index bdb9784..fac0bc7 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -12,7 +12,7 @@ import ( ) const ( - ReleaseVersion string = "1.1.0" + ReleaseVersion string = "1.2.0" ) var ( diff --git a/cmd/web.go b/cmd/web.go index 06bef34..96abfbd 100644 --- a/cmd/web.go +++ b/cmd/web.go @@ -385,6 +385,13 @@ func redirectRoot() httprouter.Handle { } func ServePage(args []string) error { + if Verbose { + fmt.Printf("%s | START: roulette v%s\n", + time.Now().Format(logDate), + ReleaseVersion, + ) + } + timeZone := os.Getenv("TZ") if timeZone != "" { var err error