Rework verbose output for visual consistency
This commit is contained in:
parent
0e8ac8cdc5
commit
19c2e616fc
43
cmd/files.go
43
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
|
||||
|
|
|
@ -12,7 +12,7 @@ import (
|
|||
)
|
||||
|
||||
const (
|
||||
ReleaseVersion string = "1.1.0"
|
||||
ReleaseVersion string = "1.2.0"
|
||||
)
|
||||
|
||||
var (
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue