Browse Source

优化命令参数

gitlink
Sydonian 1 year ago
parent
commit
d6df657ecd
1 changed files with 6 additions and 4 deletions
  1. +6
    -4
      client/internal/cmdline/sysevent.go

+ 6
- 4
client/internal/cmdline/sysevent.go View File

@@ -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) {


Loading…
Cancel
Save