Refactored and added client credentials flow

This commit is contained in:
David Allen 2024-02-29 20:14:53 -07:00
parent f912890a2d
commit f490eb4fc4
No known key found for this signature in database
GPG key ID: 1D2A29322FBB6FCB
9 changed files with 113 additions and 41 deletions

View file

@ -21,6 +21,18 @@ var rootCmd = &cobra.Command{
},
}
func Execute() {
if err := rootCmd.Execute(); err != nil {
fmt.Fprintf(os.Stderr, "failed to start CLI: %s", err)
os.Exit(1)
}
}
func init() {
cobra.OnInitialize(initConfig)
rootCmd.PersistentFlags().StringVar(&configPath, "config", "", "set the config path")
}
func initConfig() {
// load config if found or create a new one
if configPath != "" {
@ -35,15 +47,3 @@ func initConfig() {
}
}
}
func Execute() {
if err := rootCmd.Execute(); err != nil {
fmt.Fprintf(os.Stderr, "failed to start CLI: %s", err)
os.Exit(1)
}
}
func init() {
cobra.OnInitialize(initConfig)
rootCmd.PersistentFlags().StringVar(&configPath, "config", "", "set the config path")
}