Skip to content

Commit

Permalink
chore(tui): Add short message to the load command (#30)
Browse files Browse the repository at this point in the history
  • Loading branch information
Zhbert authored Oct 28, 2024
1 parent 609b5af commit 5fb3c85
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions cmd/load/load.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,13 @@ func GetLoadCommand(flags *common.ColligendisFlags) *cobra.Command {
if flags.ViewMode {
log.Printf("The download of CSV files from the catalog starts: %s...", currentDirectory)
}
var allCount = 0
var processedCount = 0
for _, csvFile := range findCsvFiles(currentDirectory, ".csv") {
processFile(csvFile, flags)
allCount++
processedCount += processFile(csvFile, flags)
}
fmt.Printf("All CSV files founded: %d\nProcessed files: %d\nFiles with errors: %d\n", allCount, processedCount, allCount-processedCount)
}
}
}
Expand Down Expand Up @@ -96,7 +100,7 @@ func findCsvFiles(pathToDir, ext string) []string {
return a
}

func processFile(csvFile string, flags *common.ColligendisFlags) {
func processFile(csvFile string, flags *common.ColligendisFlags) int {
start := time.Now()
if flags.ViewMode {
log.Printf("Parsing file %s... \n", csvFile)
Expand All @@ -110,8 +114,11 @@ func processFile(csvFile string, flags *common.ColligendisFlags) {
}
} else {
log.Printf("File %s processing error", csvFile)
return 0
}
} else {
log.Printf("The file %s encoding is not UTF-8!", csvFile)
return 0
}
return 1
}

0 comments on commit 5fb3c85

Please sign in to comment.