feat: wire --verbose/--debug flags with runtime info
This commit is contained in:
@@ -67,6 +67,7 @@ Use "ry [command] --help" for more information about a command.`,
|
|||||||
AccessKeyID: pc.AccessKeyID,
|
AccessKeyID: pc.AccessKeyID,
|
||||||
AccessKeySecret: pc.AccessKeySecret,
|
AccessKeySecret: pc.AccessKeySecret,
|
||||||
Endpoint: pc.Endpoint,
|
Endpoint: pc.Endpoint,
|
||||||
|
Debug: flagDebug,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@@ -80,6 +81,11 @@ Use "ry [command] --help" for more information about a command.`,
|
|||||||
outputFormat = "raw"
|
outputFormat = "raw"
|
||||||
}
|
}
|
||||||
out = output.New(outputFormat, os.Stdout)
|
out = output.New(outputFormat, os.Stdout)
|
||||||
|
if flagDebug {
|
||||||
|
fmt.Fprintf(os.Stderr, "[debug] provider: %s\n", providerName)
|
||||||
|
fmt.Fprintf(os.Stderr, "[debug] config: %s\n", cfgPath)
|
||||||
|
fmt.Fprintf(os.Stderr, "[debug] output: %s\n", outputFormat)
|
||||||
|
}
|
||||||
return nil
|
return nil
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@@ -89,6 +95,7 @@ func init() {
|
|||||||
rootCmd.PersistentFlags().StringVarP(&flagProvider, "provider", "p", "", "Cloud provider to use")
|
rootCmd.PersistentFlags().StringVarP(&flagProvider, "provider", "p", "", "Cloud provider to use")
|
||||||
rootCmd.PersistentFlags().StringVarP(&flagOutput, "output", "o", "", "Output format: table, json, yaml, raw")
|
rootCmd.PersistentFlags().StringVarP(&flagOutput, "output", "o", "", "Output format: table, json, yaml, raw")
|
||||||
rootCmd.PersistentFlags().BoolVar(&flagRaw, "raw", false, "Output raw API response")
|
rootCmd.PersistentFlags().BoolVar(&flagRaw, "raw", false, "Output raw API response")
|
||||||
|
rootCmd.PersistentFlags().BoolVarP(&flagDebug, "verbose", "v", false, "Enable verbose/debug output")
|
||||||
rootCmd.PersistentFlags().BoolVar(&flagDebug, "debug", false, "Enable debug output")
|
rootCmd.PersistentFlags().BoolVar(&flagDebug, "debug", false, "Enable debug output")
|
||||||
|
|
||||||
completionCmd := &cobra.Command{
|
completionCmd := &cobra.Command{
|
||||||
|
|||||||
Reference in New Issue
Block a user