added a view to the recording utility of BeamNG too

This commit is contained in:
2026-06-29 11:27:27 +01:00
parent b8d915af4f
commit 31a2f85407
4 changed files with 163 additions and 27 deletions
+10 -1
View File
@@ -1,6 +1,7 @@
package cmd
import (
"context"
"fmt"
"github.com/ESilva15/BeamNGMockOg/mockserver"
@@ -13,7 +14,15 @@ func recordAction(cmd *cobra.Command, args []string) {
address, _ := cmd.Flags().GetString("address")
port, _ := cmd.Flags().GetInt("port")
if err := mockserver.Record(address, port, outputFile); err != nil {
recorder, err := mockserver.NewRecorder(outputFile, address, port)
if err != nil {
panic(fmt.Sprintf("failed to create new BeamNG recorder: %+v", err))
}
defer recorder.Close()
// NOTE: is this doing anything at all??
ctx := context.Background()
if err := recorder.Record(ctx); err != nil {
fmt.Printf("Something went wrong while recording the file: %v", err)
}
}
+1
View File
@@ -21,6 +21,7 @@ func replayAction(cmd *cobra.Command, args []string) {
return
}
// NOTE: is this doing anything at all??
ctx := context.Background()
if err := replayer.Replay(ctx, loop); err != nil {
fmt.Printf("Something went wrong while playing the file: %v", err)