Skip to content

Commit 56f94fd

Browse files
authored
fix the terminal is damaged when parameters are missing (#5175)
1 parent 2d305ce commit 56f94fd

File tree

3 files changed

+15
-19
lines changed

3 files changed

+15
-19
lines changed

cmd/admin-replicate-resync-cancel.go

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -74,13 +74,12 @@ func (m resyncCancelMessage) String() string {
7474
}
7575

7676
func mainAdminReplicateResyncCancel(ctx *cli.Context) error {
77-
{
78-
// Check argument count
79-
argsNr := len(ctx.Args())
80-
if argsNr != 2 {
81-
cli.ShowCommandHelpAndExit(ctx, "cancel", 1) // last argument is exit code
82-
}
77+
// Check argument count
78+
argsNr := len(ctx.Args())
79+
if argsNr != 2 {
80+
showCommandHelpAndExit(ctx, 1) // last argument is exit code
8381
}
82+
8483
console.SetColor("ResyncMessage", color.New(color.FgGreen))
8584

8685
// Get the alias parameter from cli

cmd/admin-replicate-resync-start.go

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,11 @@ import (
2121
"fmt"
2222
"strings"
2323

24+
"github.com/minio/madmin-go/v3"
25+
2426
"github.com/fatih/color"
2527
"github.com/minio/cli"
2628
json "github.com/minio/colorjson"
27-
"github.com/minio/madmin-go/v3"
2829
"github.com/minio/mc/pkg/probe"
2930
"github.com/minio/pkg/v3/console"
3031
)
@@ -74,12 +75,10 @@ func (m resyncMessage) String() string {
7475
}
7576

7677
func mainAdminReplicateResyncStart(ctx *cli.Context) error {
77-
{
78-
// Check argument count
79-
argsNr := len(ctx.Args())
80-
if argsNr != 2 {
81-
cli.ShowCommandHelpAndExit(ctx, "start", 1) // last argument is exit code
82-
}
78+
// Check argument count
79+
argsNr := len(ctx.Args())
80+
if argsNr != 2 {
81+
showCommandHelpAndExit(ctx, 1) // last argument is exit code
8382
}
8483

8584
console.SetColor("ResyncMessage", color.New(color.FgGreen))

cmd/admin-replicate-resync-status.go

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,10 @@ EXAMPLES:
6060
}
6161

6262
func mainAdminReplicationResyncStatus(ctx *cli.Context) error {
63-
{
64-
// Check argument count
65-
argsNr := len(ctx.Args())
66-
if argsNr != 2 {
67-
cli.ShowCommandHelpAndExit(ctx, "status", 1) // last argument is exit code
68-
}
63+
// Check argument count
64+
argsNr := len(ctx.Args())
65+
if argsNr != 2 {
66+
showCommandHelpAndExit(ctx, 1) // last argument is exit code
6967
}
7068

7169
console.SetColor("ResyncMessage", color.New(color.FgGreen))

0 commit comments

Comments
 (0)