From 136ab9b2501ff9607c6baf57330cb95f64a4d34b Mon Sep 17 00:00:00 2001 From: Blerim Sheqa Date: Tue, 17 Oct 2017 10:19:42 +0200 Subject: [PATCH] Move beater interface to cmd package --- cmd/root.go | 12 ++++++++++++ main.go | 7 ++----- 2 files changed, 14 insertions(+), 5 deletions(-) create mode 100644 cmd/root.go diff --git a/cmd/root.go b/cmd/root.go new file mode 100644 index 00000000..9dd3b9cf --- /dev/null +++ b/cmd/root.go @@ -0,0 +1,12 @@ +package cmd + +import ( + cmd "github.com/elastic/beats/libbeat/cmd" + "github.com/icinga/icingabeat/beater" +) + +// Name of this beat +var Name = "icingabeat" + +// RootCmd to handle beats cli +var RootCmd = cmd.GenRootCmd(Name, "", beater.New) diff --git a/main.go b/main.go index 23c8bad9..79148b0b 100644 --- a/main.go +++ b/main.go @@ -3,14 +3,11 @@ package main import ( "os" - "github.com/elastic/beats/libbeat/beat" - - "github.com/icinga/icingabeat/beater" + "github.com/icinga/icingabeat/cmd" ) func main() { - err := beat.Run("icingabeat", "", beater.New) - if err != nil { + if err := cmd.RootCmd.Execute(); err != nil { os.Exit(1) } }