ailistener

git clone git://archive.git.mtrnord.blog/OpenHomeAuto/ailistener.git
Log | Files | Refs | LICENSE

root.go (1933B)


      1 // Copyright © 2018 Marcel Radzio
      2 //
      3 // Licensed under the Apache License, Version 2.0 (the "License");
      4 // you may not use this file except in compliance with the License.
      5 // You may obtain a copy of the License at
      6 //
      7 //     http://www.apache.org/licenses/LICENSE-2.0
      8 //
      9 // Unless required by applicable law or agreed to in writing, software
     10 // distributed under the License is distributed on an "AS IS" BASIS,
     11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     12 // See the License for the specific language governing permissions and
     13 // limitations under the License.
     14 
     15 package cmd
     16 
     17 import (
     18 	"fmt"
     19 	"os"
     20 
     21 	"github.com/OpenHomeAuto/AiListener/pkg/util"
     22 	"github.com/OpenHomeAuto/AiListener/pkg/webhook"
     23 	"github.com/spf13/cobra"
     24 )
     25 
     26 var cfgFile string
     27 
     28 // rootCmd represents the base command when called without any subcommands
     29 var rootCmd = &cobra.Command{
     30 	Use:   "AiListener",
     31 	Short: "A brief description of your application",
     32 	Long: `A longer description that spans multiple lines and likely contains
     33 examples and usage of using your application. For example:
     34 
     35 Cobra is a CLI library for Go that empowers applications.
     36 This application is a tool to generate the needed files
     37 to quickly create a Cobra application.`,
     38 	// Uncomment the following line if your bare application
     39 	// has an action associated with it:
     40 	Run: func(cmd *cobra.Command, args []string) {
     41 		webhook.Start()
     42 	},
     43 }
     44 
     45 // Execute adds all child commands to the root command and sets flags appropriately.
     46 // This is called by main.main(). It only needs to happen once to the rootCmd.
     47 func Execute() {
     48 	if err := rootCmd.Execute(); err != nil {
     49 		fmt.Println(err)
     50 		os.Exit(1)
     51 	}
     52 }
     53 
     54 func init() {
     55 	util.ServiceAccountFilePath = rootCmd.Flags().String("serviceAccountJson", "", "Enter a Path to the exported json file from your service account")
     56 	util.HTTPSPort = rootCmd.Flags().Int("https-port", 8888, "Define the SSL Port to listen on")
     57 }