mirror of
https://github.com/RoganDawes/P4wnP1_aloa.git
synced 2025-03-18 13:52:04 +01:00
30 lines
590 B
Go
30 lines
590 B
Go
package cli_client
|
|
|
|
import (
|
|
"github.com/spf13/cobra"
|
|
"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(tmpEventID)
|
|
if err != nil { log.Fatal(err)}
|
|
},
|
|
}
|
|
|
|
func receiveEvent(eType int64) (err error) {
|
|
return ClientRegisterEvent(StrRemoteHost, StrRemotePort, eType)
|
|
}
|
|
|
|
|
|
|
|
func init() {
|
|
rootCmd.AddCommand(evtCmd)
|
|
evtCmd.Flags().Int64VarP(&tmpEventID,"event-id", "i", 0,"Listen to events of given ID (0 = Any)")
|
|
}
|