fix the terminal is damaged when parameters are missing (#5175)

This commit is contained in:
dorman
2025-04-03 10:07:56 -07:00
committed by GitHub
parent 2d305ce990
commit 56f94fd375
3 changed files with 15 additions and 19 deletions
+5 -6
View File
@@ -74,13 +74,12 @@ func (m resyncCancelMessage) String() string {
}
func mainAdminReplicateResyncCancel(ctx *cli.Context) error {
{
// Check argument count
argsNr := len(ctx.Args())
if argsNr != 2 {
cli.ShowCommandHelpAndExit(ctx, "cancel", 1) // last argument is exit code
}
// Check argument count
argsNr := len(ctx.Args())
if argsNr != 2 {
showCommandHelpAndExit(ctx, 1) // last argument is exit code
}
console.SetColor("ResyncMessage", color.New(color.FgGreen))
// Get the alias parameter from cli
+6 -7
View File
@@ -21,10 +21,11 @@ import (
"fmt"
"strings"
"github.com/minio/madmin-go/v3"
"github.com/fatih/color"
"github.com/minio/cli"
json "github.com/minio/colorjson"
"github.com/minio/madmin-go/v3"
"github.com/minio/mc/pkg/probe"
"github.com/minio/pkg/v3/console"
)
@@ -74,12 +75,10 @@ func (m resyncMessage) String() string {
}
func mainAdminReplicateResyncStart(ctx *cli.Context) error {
{
// Check argument count
argsNr := len(ctx.Args())
if argsNr != 2 {
cli.ShowCommandHelpAndExit(ctx, "start", 1) // last argument is exit code
}
// Check argument count
argsNr := len(ctx.Args())
if argsNr != 2 {
showCommandHelpAndExit(ctx, 1) // last argument is exit code
}
console.SetColor("ResyncMessage", color.New(color.FgGreen))
+4 -6
View File
@@ -60,12 +60,10 @@ EXAMPLES:
}
func mainAdminReplicationResyncStatus(ctx *cli.Context) error {
{
// Check argument count
argsNr := len(ctx.Args())
if argsNr != 2 {
cli.ShowCommandHelpAndExit(ctx, "status", 1) // last argument is exit code
}
// Check argument count
argsNr := len(ctx.Args())
if argsNr != 2 {
showCommandHelpAndExit(ctx, 1) // last argument is exit code
}
console.SetColor("ResyncMessage", color.New(color.FgGreen))