From d6df657ecd0212401cade88fb575423a750aedef Mon Sep 17 00:00:00 2001 From: Sydonian <794346190@qq.com> Date: Fri, 14 Feb 2025 17:46:03 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=91=BD=E4=BB=A4=E5=8F=82?= =?UTF-8?q?=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/internal/cmdline/sysevent.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) 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) {