Skip to content

Commit

Permalink
fix bash completion on mgrctl
Browse files Browse the repository at this point in the history
  • Loading branch information
mbussolotto committed Oct 30, 2024
1 parent dfc1610 commit 5092429
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
5 changes: 2 additions & 3 deletions mgrctl/cmd/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,10 @@ func NewUyunictlCommand() *cobra.Command {
rootCmd.PersistentFlags().StringVar(&globalFlags.LogLevel, "logLevel", "", L("application log level")+"(trace|debug|info|warn|error|fatal|panic)")

rootCmd.PersistentPreRun = func(cmd *cobra.Command, args []string) {
utils.LogInit((cmd.Name() != "exec" && cmd.Name() != "term") || globalFlags.LogLevel == "trace")
utils.SetLogLevel(globalFlags.LogLevel)

// do not log if running the completion cmd as the output is redirect to create a file to source
if cmd.Name() != "completion" {
utils.LogInit((cmd.Name() != "exec" && cmd.Name() != "term") || globalFlags.LogLevel == "trace")
utils.SetLogLevel(globalFlags.LogLevel)
log.Info().Msgf(L("Welcome to %s"), name)
log.Info().Msgf(L("Executing command: %s"), cmd.Name())
}
Expand Down
5 changes: 2 additions & 3 deletions mgrpxy/cmd/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,10 @@ func NewUyuniproxyCommand() (*cobra.Command, error) {
rootCmd.SetUsageTemplate(utils.GetLocalizedUsageTemplate())

rootCmd.PersistentPreRun = func(cmd *cobra.Command, args []string) {
utils.LogInit(true)
utils.SetLogLevel(globalFlags.LogLevel)

// do not log if running the completion cmd as the output is redirected to create a file to source
if cmd.Name() != "completion" && cmd.Name() != "__complete" {
utils.LogInit(true)
utils.SetLogLevel(globalFlags.LogLevel)
log.Info().Msgf(L("Welcome to %s"), name)
log.Info().Msgf(L("Executing command: %s"), cmd.Name())
}
Expand Down

0 comments on commit 5092429

Please sign in to comment.