implmented rename subcommand

This commit is contained in:
2026-01-05 13:28:33 +01:00
parent 8e83c99620
commit d826646a5a
2 changed files with 38 additions and 1 deletions

View File

@@ -22,8 +22,38 @@ func Scan(file string, config Config) {
gameList, err := loadGamelist("./ps2-gameslist.txt")
if err != nil {
fmt.Printf("Failed to load game list: %v", err)
os.Exit(1)
}
gameName := gameList[gameID]
fmt.Printf("Found game name: %s\n", gameName)
}
func Rename(file string, config Config) {
fmt.Printf("Scanning file: %s\n", file)
gameID, err := scanGameFileForID(file)
if err != nil {
fmt.Printf("Failed to scan game file: %s", err)
os.Exit(1)
}
fmt.Printf("Found game ID: %s\n", gameID)
gameList, err := loadGamelist("./ps2-gameslist.txt")
if err != nil {
fmt.Printf("Failed to load game list: %v", err)
os.Exit(1)
}
gameName := gameList[gameID]
fmt.Printf("Found game name: %s\n", gameName)
newPath, err := renameGameFile(file, gameName)
if err != nil {
fmt.Printf("Failed to rename file: %v", err)
os.Exit(1)
}
fmt.Printf("Renamed %s to %s", file, newPath)
}