Moved the code its respective places instead of being all mixed up

This commit is contained in:
2025-10-21 20:30:26 +01:00
parent 5eacf8ef16
commit d52f8bcfa5
13 changed files with 122 additions and 111 deletions
+40
View File
@@ -0,0 +1,40 @@
package cmd
import (
"esdi/esdi"
"esdi/logger"
"github.com/spf13/cobra"
)
func liveTelemetryCmdAction(cmd *cobra.Command, args []string) {
log := logger.GetInstance()
ddPort, _ := cmd.Flags().GetString("port")
outputFile, _ := cmd.Flags().GetString("out")
sessionFile, _ := cmd.Flags().GetString("session")
log.Printf("Called `live`:\nPort: '%s'\nOutFile: '%s'\n", ddPort, outputFile)
esdi.RunLiveTelemetry(ddPort, outputFile, sessionFile)
}
// removeLabelCmd represents the removeLabel command
var liveTelemetryCmd = &cobra.Command{
Use: "live",
Short: "stream data directly from the game",
Long: ``,
Run: liveTelemetryCmdAction,
}
func init() {
rootCmd.AddCommand(liveTelemetryCmd)
// Declare the flags for this command
liveTelemetryCmd.Flags().StringP("port", "p", "", "dashDisplay Port")
// liveTelemetryCmd.Flags().StringP("out", "o", "", "output to an .ibt file")
// liveTelemetryCmd.Flags().StringP("session", "s", "", "output session .yaml to file")
// Mark the required ones
liveTelemetryCmd.MarkFlagRequired("port")
}