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) {
|
func validatePaths(args []string, formats *types.Types) ([]string, error) {
|
||||||
var paths []string
|
var paths []string
|
||||||
|
|
||||||
var pathList strings.Builder
|
|
||||||
pathList.WriteString("Paths:\n")
|
|
||||||
|
|
||||||
for i := 0; i < len(args); i++ {
|
for i := 0; i < len(args); i++ {
|
||||||
path, err := normalizePath(args[i])
|
path, err := normalizePath(args[i])
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -514,28 +511,34 @@ func validatePaths(args []string, formats *types.Types) ([]string, error) {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
var addPath = false
|
|
||||||
|
|
||||||
switch {
|
switch {
|
||||||
case pathMatches && hasSupportedFiles:
|
case pathMatches && hasSupportedFiles:
|
||||||
pathList.WriteString(fmt.Sprintf("%s\n", args[i]))
|
fmt.Printf("%s | PATHS: Added %s\n",
|
||||||
addPath = true
|
time.Now().Format(logDate),
|
||||||
case !pathMatches && hasSupportedFiles:
|
args[i],
|
||||||
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))
|
|
||||||
}
|
|
||||||
|
|
||||||
if addPath {
|
|
||||||
paths = append(paths, path)
|
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 {
|
paths = append(paths, path)
|
||||||
fmt.Println(pathList.String())
|
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
|
return paths, nil
|
||||||
|
|
|
@ -12,7 +12,7 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
ReleaseVersion string = "1.1.0"
|
ReleaseVersion string = "1.2.0"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|
|
@ -385,6 +385,13 @@ func redirectRoot() httprouter.Handle {
|
||||||
}
|
}
|
||||||
|
|
||||||
func ServePage(args []string) error {
|
func ServePage(args []string) error {
|
||||||
|
if Verbose {
|
||||||
|
fmt.Printf("%s | START: roulette v%s\n",
|
||||||
|
time.Now().Format(logDate),
|
||||||
|
ReleaseVersion,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
timeZone := os.Getenv("TZ")
|
timeZone := os.Getenv("TZ")
|
||||||
if timeZone != "" {
|
if timeZone != "" {
|
||||||
var err error
|
var err error
|
||||||
|
|
Loading…
Reference in New Issue