@@ -18,7 +18,12 @@ var configShowCmd = &cobra.Command{
1818 Use : "show" ,
1919 Short : "Show current configuration" ,
2020 Run : func (cmd * cobra.Command , args []string ) {
21- manager := config .NewManager ()
21+ logLevel , _ := cmd .Root ().PersistentFlags ().GetString ("log-level" )
22+ verbose , _ := cmd .Root ().PersistentFlags ().GetBool ("verbose" )
23+ if verbose {
24+ logLevel = "debug"
25+ }
26+ manager := config .NewManagerWithLevel (logLevel )
2227
2328 // Get config path from global flags
2429 configPath , _ := cmd .Root ().PersistentFlags ().GetString ("config" )
@@ -47,7 +52,12 @@ var configInitCmd = &cobra.Command{
4752 Use : "init" ,
4853 Short : "Initialize default configuration file" ,
4954 Run : func (cmd * cobra.Command , args []string ) {
50- manager := config .NewManager ()
55+ logLevel , _ := cmd .Root ().PersistentFlags ().GetString ("log-level" )
56+ verbose , _ := cmd .Root ().PersistentFlags ().GetBool ("verbose" )
57+ if verbose {
58+ logLevel = "debug"
59+ }
60+ manager := config .NewManagerWithLevel (logLevel )
5161
5262 // Get config path from global flags
5363 configPath , _ := cmd .Root ().PersistentFlags ().GetString ("config" )
@@ -78,7 +88,12 @@ var configValidateCmd = &cobra.Command{
7888 Use : "validate" ,
7989 Short : "Validate configuration file" ,
8090 Run : func (cmd * cobra.Command , args []string ) {
81- manager := config .NewManager ()
91+ logLevel , _ := cmd .Root ().PersistentFlags ().GetString ("log-level" )
92+ verbose , _ := cmd .Root ().PersistentFlags ().GetBool ("verbose" )
93+ if verbose {
94+ logLevel = "debug"
95+ }
96+ manager := config .NewManagerWithLevel (logLevel )
8297 configPath , _ := cmd .Root ().PersistentFlags ().GetString ("config" )
8398 if configPath != "" {
8499 manager .SetConfigPath (configPath )
0 commit comments