Merge branch 'feat/verbose-debug' into master

This commit is contained in:
2026-07-30 01:04:48 +08:00
9 changed files with 446 additions and 32 deletions
+8 -2
View File
@@ -26,7 +26,7 @@ var (
flagProvider string
flagOutput string
flagRaw bool
flagDebug bool
flagVerbose bool
)
var rootCmd = &cobra.Command{
@@ -67,6 +67,7 @@ Use "ry [command] --help" for more information about a command.`,
AccessKeyID: pc.AccessKeyID,
AccessKeySecret: pc.AccessKeySecret,
Endpoint: pc.Endpoint,
Debug: flagVerbose,
})
if err != nil {
return err
@@ -80,6 +81,11 @@ Use "ry [command] --help" for more information about a command.`,
outputFormat = "raw"
}
out = output.New(outputFormat, os.Stdout)
if flagVerbose {
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
},
}
@@ -89,7 +95,7 @@ func init() {
rootCmd.PersistentFlags().StringVarP(&flagProvider, "provider", "p", "", "Cloud provider to use")
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(&flagDebug, "debug", false, "Enable debug output")
rootCmd.PersistentFlags().BoolVarP(&flagVerbose, "verbose", "v", false, "Enable verbose output")
completionCmd := &cobra.Command{
Use: "completion [bash|zsh|fish]",