diff --git a/client/internal/cmdline/sysevent.go b/client/internal/cmdline/sysevent.go index f339c7b..d110ae6 100644 --- a/client/internal/cmdline/sysevent.go +++ b/client/internal/cmdline/sysevent.go @@ -18,14 +18,16 @@ func init() { rootCmd.AddCommand(cmd) - outputJSON := rootCmd.Flags().BoolP("json", "j", false, "output in JSON format") - cmd.AddCommand(&cobra.Command{ + outputJSON := false + watchCmd := &cobra.Command{ Use: "watch", Short: "Watch system events", Run: func(cmd *cobra.Command, args []string) { - watchSysEvent(*outputJSON) + watchSysEvent(outputJSON) }, - }) + } + watchCmd.Flags().BoolVarP(&outputJSON, "json", "j", false, "output in JSON format") + cmd.AddCommand(watchCmd) } func watchSysEvent(outputJSON bool) {