/* Copyright © 2022 Matthieu Derasse */ package cmd import ( "os" "git.home.m-and-m.ovh/mderasse/boot/helpers/dependencies" "github.com/spf13/cobra" log "github.com/sirupsen/logrus" ) var verbose = false var acceptAll = false var dependencyList = []dependencies.Dependency{ dependencies.Git{}, dependencies.Golang{}, dependencies.Swagger{}, } // rootCmd represents the base command when called without any subcommands var rootCmd = &cobra.Command{ Use: "boot", Short: "Boot is a toolbox app to bootstrap quickly a Go-Swagger API", Long: `Boot is a toolbox app to bootstrap quickly a Go-Swagger API. It will: - Auto-Update - Download dependencies (go-swagger, ...) - Initialize an API with default middlewares - Generate Models / Controlers - Generate Database structs - ....`, PersistentPreRun: func(cmd *cobra.Command, args []string) { if verbose { log.SetLevel(log.DebugLevel) } }, } // Execute adds all child commands to the root command and sets flags appropriately. // This is called by main.main(). It only needs to happen once to the rootCmd. func Execute() { err := rootCmd.Execute() if err != nil { os.Exit(1) } } func init() { rootCmd.PersistentFlags().BoolVarP(&verbose, "verbose", "v", false, "enable verbose logging") rootCmd.PersistentFlags().BoolVarP(&acceptAll, "yes", "y", false, "accept all change, disable interactive process") }