Skip to content

Commit

Permalink
fix(edit): return early (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
zze0s authored Sep 24, 2023
1 parent 9da7b9b commit 9949e6e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
4 changes: 2 additions & 2 deletions cmd/bencode.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,12 @@ func RunBencodeEdit() *cobra.Command {
processedFiles++

if verbose {
fmt.Printf("[%d/%d] sucessfully processed file %s\n", len(files), processedFiles, fileName)
log.Printf("[%d/%d] sucessfully processed file %s\n", len(files), processedFiles, fileName)
}

}

fmt.Printf("migraterr bencode processed %d files\n", processedFiles)
log.Printf("migraterr bencode processed %d files\n", processedFiles)
}

return command
Expand Down
7 changes: 4 additions & 3 deletions internal/bencoding/bencode.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,15 @@ func Process(filePath, exportDir string, replacements []string, verbose, dry boo
case string:
if strings.Contains(val, parts[0]) {
decodedFile[k] = strings.Replace(val, parts[0], parts[1], -1)

if verbose {
log.Printf("replaced: '%s' with '%s'\n", parts[0], parts[1])
}
}
default:
continue
}

if verbose {
fmt.Printf("replaced: '%s' with '%s'\n", parts[0], parts[1])
}
}
}
}
Expand Down

0 comments on commit 9949e6e

Please sign in to comment.