Initial prototype
Change-Id: I60a94e90aab48dfcf7c1f03fe5613d1db7d0df95
diff --git a/cmd/hichipbridge/root.go b/cmd/hichipbridge/root.go
new file mode 100644
index 0000000..42eebdb
--- /dev/null
+++ b/cmd/hichipbridge/root.go
@@ -0,0 +1,32 @@
+package main
+
+import (
+ "github.com/sirupsen/logrus"
+ "github.com/spf13/cobra"
+)
+
+var rootCmd = &cobra.Command{
+ Use: "hichipbridge",
+ Short: "hichip2mqtt bridge daemon",
+ Long: `Daemon which serves as a bridge for hichip IP cameras and MQTT.
+Basically, it converts motion trigger emails notifications received into a state
+published in a MQTT topic.`,
+ Run: nil,
+}
+
+var (
+ verbose bool
+)
+
+func init() {
+ cobra.OnInitialize()
+ rootCmd.PersistentFlags().BoolVarP(&verbose, "verbose", "v", false,
+ "print out more debug information")
+ rootCmd.PersistentPreRun = func(cmd *cobra.Command, args []string) {
+ if verbose {
+ logrus.SetLevel(logrus.DebugLevel)
+ } else {
+ logrus.SetLevel(logrus.InfoLevel)
+ }
+ }
+}