Allow CLI client to display events of arbitrary type

This commit is contained in:
MaMe82 2018-07-29 02:41:33 +02:00
parent 8f553db5c3
commit 23077af2a9

View File

@ -2,16 +2,17 @@ package cli_client
import (
"github.com/spf13/cobra"
"../common"
"log"
)
var tmpEventID int64
// usbCmd represents the usb command
var evtCmd = &cobra.Command{
Use: "EVT",
Short: "Receive P4wnP1 service events",
Run: func(cmd *cobra.Command, args []string) {
err := receiveEvent(common.EVT_LOG)
err := receiveEvent(tmpEventID)
if err != nil { log.Fatal(err)}
},
}
@ -24,4 +25,5 @@ func receiveEvent(eType int64) (err error) {
func init() {
rootCmd.AddCommand(evtCmd)
evtCmd.Flags().Int64VarP(&tmpEventID,"event-id", "i", 0,"Listen to events of given ID (0 = Any)")
}