Added firmware command to retrieve firmare info

This commit is contained in:
Jonas Köritz 2019-08-29 10:12:56 +02:00
parent a5b3404d5c
commit 98dd434503
2 changed files with 25 additions and 10 deletions

View file

@ -97,6 +97,20 @@ func main() {
},
}
var version = &cobra.Command{
Use: "version [Cameras IP Address]",
Short: "Retrieve software version information from the camera",
Args: cobra.ExactArgs(1),
Run: func(cmd *cobra.Command, args []string) {
firmware, err := camera.GetFirmwareInfo()
if err != nil {
log.Printf("ERROR retrieving version info: %s\n", err)
return
}
log.Printf("Firmware Version: %s\n", firmware)
},
}
var cmd = &cobra.Command{
Use: "cmd [RAW Command] [Cameras IP Address]",
Short: "Send a raw command to the camera",
@ -145,6 +159,7 @@ func main() {
rootCmd.AddCommand(stop)
rootCmd.AddCommand(fetch)
rootCmd.AddCommand(record)
rootCmd.AddCommand(version)
if err := rootCmd.Execute(); err != nil {
log.Println(err)