Skip to content

Commit

Permalink
Refactor ImportLogsCmd to simplify command usage and improve argument…
Browse files Browse the repository at this point in the history
… handling
  • Loading branch information
abaldeweg authored Jan 27, 2025
1 parent f1956a7 commit a959e62
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions logs_import/cmd/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,8 @@ import (

// ImportLogsCmd reads logs from the log file and imports them into the database.
var ImportLogsCmd = &cobra.Command{
Use: "import [file]",
Use: "import",
Short: "Read logs from the log file and import them into the database",
Args: cobra.MaximumNArgs(1),
Run: func(cmd *cobra.Command, args []string) {
entries, err := parser.ReadLogEntries()
if err != nil {
Expand All @@ -34,7 +33,7 @@ var ImportLogsCmd = &cobra.Command{

for _, entry := range entries {
date, _ := strconv.Atoi(time.Time(entry.Time).Format("20060102"))
fmt.Println(date)
fmt.Println(date)
exists, err := h.Exists(date, entry)
if err != nil {
log.Println(err)
Expand Down

0 comments on commit a959e62

Please sign in to comment.