diff --git a/cmd/admin-bucket-info.go b/cmd/admin-bucket-info.go index ae189eae..e028be3c 100644 --- a/cmd/admin-bucket-info.go +++ b/cmd/admin-bucket-info.go @@ -19,7 +19,6 @@ package cmd import ( "github.com/minio/cli" - "github.com/minio/pkg/console" ) var adminBucketInfoFlags = []cli.Flag{} @@ -37,6 +36,6 @@ var adminBucketInfoCmd = cli.Command{ // mainAdminBucketInfo is the handler for "mc admin bucket info" command. func mainAdminBucketInfo(_ *cli.Context) error { - console.Infoln("Please use 'mc stat'") + deprecatedError("mc stat") return nil } diff --git a/cmd/admin-bucket-quota.go b/cmd/admin-bucket-quota.go index f7b24cc4..95e6c012 100644 --- a/cmd/admin-bucket-quota.go +++ b/cmd/admin-bucket-quota.go @@ -19,7 +19,6 @@ package cmd import ( "github.com/minio/cli" - "github.com/minio/pkg/console" ) var adminQuotaFlags = []cli.Flag{ @@ -46,6 +45,6 @@ var adminBucketQuotaCmd = cli.Command{ // mainAdminBucketQuota is the handler for "mc admin bucket quota" command. func mainAdminBucketQuota(_ *cli.Context) error { - console.Infoln("Please use 'mc quota'") + deprecatedError("mc quota") return nil } diff --git a/cmd/admin-bucket-remote-add.go b/cmd/admin-bucket-remote-add.go index a0fdfc45..43c05e02 100644 --- a/cmd/admin-bucket-remote-add.go +++ b/cmd/admin-bucket-remote-add.go @@ -19,7 +19,6 @@ package cmd import ( "github.com/minio/cli" - "github.com/minio/pkg/console" ) var adminBucketRemoteAddCmd = cli.Command{ @@ -35,6 +34,6 @@ var adminBucketRemoteAddCmd = cli.Command{ // mainAdminBucketRemoteAdd is the handle for "mc admin bucket remote set" command. func mainAdminBucketRemoteAdd(_ *cli.Context) error { - console.Infoln("Please use 'mc replicate add'") + deprecatedError("mc replicate add") return nil } diff --git a/cmd/admin-bucket-remote-edit.go b/cmd/admin-bucket-remote-edit.go index 49140719..8eec36ab 100644 --- a/cmd/admin-bucket-remote-edit.go +++ b/cmd/admin-bucket-remote-edit.go @@ -19,7 +19,6 @@ package cmd import ( "github.com/minio/cli" - "github.com/minio/pkg/console" ) var adminBucketRemoteEditCmd = cli.Command{ @@ -35,6 +34,6 @@ var adminBucketRemoteEditCmd = cli.Command{ // mainAdminBucketRemoteEdit is the handle for "mc admin bucket remote edit" command. func mainAdminBucketRemoteEdit(_ *cli.Context) error { - console.Infoln("Please use 'mc replicate update'") + deprecatedError("mc replicate update") return nil } diff --git a/cmd/admin-bucket-remote-rm.go b/cmd/admin-bucket-remote-rm.go index b3a6f32e..3e306c29 100644 --- a/cmd/admin-bucket-remote-rm.go +++ b/cmd/admin-bucket-remote-rm.go @@ -19,7 +19,6 @@ package cmd import ( "github.com/minio/cli" - "github.com/minio/pkg/console" ) var adminBucketRemoteRmCmd = cli.Command{ @@ -35,6 +34,6 @@ var adminBucketRemoteRmCmd = cli.Command{ // mainAdminBucketRemoteRemove is the handle for "mc admin bucket remote rm" command. func mainAdminBucketRemoteRemove(_ *cli.Context) error { - console.Infoln("Please use 'mc replicate rm'") + deprecatedError("mc replicate rm") return nil } diff --git a/cmd/admin-console.go b/cmd/admin-console.go index 936432e7..c8e8b8fb 100644 --- a/cmd/admin-console.go +++ b/cmd/admin-console.go @@ -22,7 +22,6 @@ import ( "strings" "github.com/minio/cli" - "github.com/minio/pkg/console" ) var adminConsoleFlags = []cli.Flag{ @@ -67,7 +66,6 @@ func mainAdminConsole(ctx *cli.Context) error { } newCmd = append(newCmd, ctx.Args()...) - msg := fmt.Sprintf("Please use '%s'", strings.Join(newCmd, " ")) - console.Infoln(msg) + deprecatedError(strings.Join(newCmd, " ")) return nil } diff --git a/cmd/admin-inspect.go b/cmd/admin-inspect.go index 9838732e..a6ff1558 100644 --- a/cmd/admin-inspect.go +++ b/cmd/admin-inspect.go @@ -19,7 +19,6 @@ package cmd import ( "github.com/minio/cli" - "github.com/minio/pkg/console" ) var adminInspectCmd = cli.Command{ @@ -35,6 +34,6 @@ var adminInspectCmd = cli.Command{ // mainAdminHeal - the entry function of heal command func mainAdminInspect(_ *cli.Context) error { - console.Infoln("Please use 'mc support inspect'") + deprecatedError("mc support inspect") return nil } diff --git a/cmd/admin-policy-add.go b/cmd/admin-policy-add.go index 7920f61b..68dc194d 100644 --- a/cmd/admin-policy-add.go +++ b/cmd/admin-policy-add.go @@ -18,10 +18,7 @@ package cmd import ( - "fmt" - "github.com/minio/cli" - "github.com/minio/mc/pkg/probe" ) var adminPolicyAddCmd = cli.Command{ @@ -37,7 +34,6 @@ var adminPolicyAddCmd = cli.Command{ } func mainAdminPolicyAdd(_ *cli.Context) error { - err := probe.NewError(fmt.Errorf("Please use 'mc admin policy create'")) - fatal(err, "Incorrect command") + deprecatedError("mc admin policy create") return nil } diff --git a/cmd/admin-policy-set.go b/cmd/admin-policy-set.go index e23df761..de639297 100644 --- a/cmd/admin-policy-set.go +++ b/cmd/admin-policy-set.go @@ -18,10 +18,7 @@ package cmd import ( - "fmt" - "github.com/minio/cli" - "github.com/minio/mc/pkg/probe" ) var adminPolicySetCmd = cli.Command{ @@ -37,7 +34,6 @@ var adminPolicySetCmd = cli.Command{ } func mainAdminPolicySet(_ *cli.Context) error { - err := probe.NewError(fmt.Errorf("Please use 'mc admin policy attach'")) - fatal(err, "Incorrect command") + deprecatedError("mc admin policy attach") return nil } diff --git a/cmd/admin-policy-unset.go b/cmd/admin-policy-unset.go index b580268c..cf0e34d7 100644 --- a/cmd/admin-policy-unset.go +++ b/cmd/admin-policy-unset.go @@ -18,10 +18,7 @@ package cmd import ( - "fmt" - "github.com/minio/cli" - "github.com/minio/mc/pkg/probe" ) var adminPolicyUnsetCmd = cli.Command{ @@ -37,7 +34,6 @@ var adminPolicyUnsetCmd = cli.Command{ } func mainAdminPolicyUnsetErr(_ *cli.Context) error { - err := probe.NewError(fmt.Errorf("Please use 'mc admin policy detach'")) - fatal(err, "Incorrect command") + deprecatedError("mc admin policy detach") return nil } diff --git a/cmd/admin-policy-update.go b/cmd/admin-policy-update.go index 01fe7773..7974b09b 100644 --- a/cmd/admin-policy-update.go +++ b/cmd/admin-policy-update.go @@ -18,10 +18,7 @@ package cmd import ( - "fmt" - "github.com/minio/cli" - "github.com/minio/mc/pkg/probe" ) var adminPolicyUpdateCmd = cli.Command{ @@ -37,7 +34,6 @@ var adminPolicyUpdateCmd = cli.Command{ } func mainAdminPolicyUpdateErr(_ *cli.Context) error { - err := probe.NewError(fmt.Errorf("Please use 'mc admin policy attach'")) - fatal(err, "Incorrect command") + deprecatedError("mc admin policy attach") return nil } diff --git a/cmd/admin-profile-start.go b/cmd/admin-profile-start.go index e17d8118..07240c9c 100644 --- a/cmd/admin-profile-start.go +++ b/cmd/admin-profile-start.go @@ -19,7 +19,6 @@ package cmd import ( "github.com/minio/cli" - "github.com/minio/pkg/console" ) var adminProfileStartCmd = cli.Command{ @@ -35,6 +34,6 @@ var adminProfileStartCmd = cli.Command{ // mainAdminProfileStart - the entry function of profile command func mainAdminProfileStart(_ *cli.Context) error { - console.Infoln("Please use 'mc support profile start'") + deprecatedError("mc support profile start") return nil } diff --git a/cmd/admin-profile-stop.go b/cmd/admin-profile-stop.go index fc1f90cd..1fddfdab 100644 --- a/cmd/admin-profile-stop.go +++ b/cmd/admin-profile-stop.go @@ -19,7 +19,6 @@ package cmd import ( "github.com/minio/cli" - "github.com/minio/pkg/console" ) var adminProfileStopCmd = cli.Command{ @@ -36,6 +35,6 @@ var adminProfileStopCmd = cli.Command{ // mainAdminProfileStop - the entry function of profile stop command func mainAdminProfileStop(_ *cli.Context) error { - console.Infoln("Please use 'mc support profile stop'") + deprecatedError("mc support profile stop") return nil } diff --git a/cmd/admin-profile.go b/cmd/admin-profile.go index 6acabf56..4f88a38e 100644 --- a/cmd/admin-profile.go +++ b/cmd/admin-profile.go @@ -19,7 +19,6 @@ package cmd import ( "github.com/minio/cli" - "github.com/minio/pkg/console" ) var adminProfileSubcommands = []cli.Command{ @@ -41,6 +40,6 @@ var adminProfileCmd = cli.Command{ // mainAdminProfile is the handle for "mc admin profile" command. func mainAdminProfile(_ *cli.Context) error { - console.Infoln("Please use 'mc support profile'") + deprecatedError("mc support profile") return nil } diff --git a/cmd/admin-subnet-health.go b/cmd/admin-subnet-health.go index 05217c9b..c61fcb8f 100644 --- a/cmd/admin-subnet-health.go +++ b/cmd/admin-subnet-health.go @@ -23,7 +23,6 @@ import ( "github.com/minio/cli" "github.com/minio/minio-go/v7/pkg/set" - "github.com/minio/pkg/console" ) var adminSubnetHealthCmd = cli.Command{ @@ -59,7 +58,7 @@ func mainSubnetHealth(ctx *cli.Context) error { } newCmd = append(newCmd, flgStr) } - msg := fmt.Sprintf("Please use '%s'", strings.Join(newCmd, " ")) - console.Infoln(msg) + + deprecatedError(strings.Join(newCmd, " ")) return nil } diff --git a/cmd/admin-subnet-register.go b/cmd/admin-subnet-register.go index f1a08bb5..12de8a1c 100644 --- a/cmd/admin-subnet-register.go +++ b/cmd/admin-subnet-register.go @@ -19,7 +19,6 @@ package cmd import ( "github.com/minio/cli" - "github.com/minio/pkg/console" ) var adminSubnetRegisterCmd = cli.Command{ @@ -33,6 +32,6 @@ var adminSubnetRegisterCmd = cli.Command{ } func mainAdminRegister(_ *cli.Context) error { - console.Infoln("Please use 'mc support register'") + deprecatedError("mc support register") return nil } diff --git a/cmd/admin-subnet.go b/cmd/admin-subnet.go index 734529d8..db2331a5 100644 --- a/cmd/admin-subnet.go +++ b/cmd/admin-subnet.go @@ -19,7 +19,6 @@ package cmd import ( "github.com/minio/cli" - "github.com/minio/pkg/console" ) var subnetHealthSubcommands = []cli.Command{ @@ -39,7 +38,7 @@ var adminSubnetCmd = cli.Command{ // mainAdminSubnet is the handle for "mc admin subnet" command. func mainAdminSubnet(_ *cli.Context) error { - console.Infoln("Please use 'mc support'") + deprecatedError("mc support") return nil // Sub-commands like "health", "register" have their own main. } diff --git a/cmd/admin-tier-main.go b/cmd/admin-tier-main.go index 1757bd28..66a9b6b1 100644 --- a/cmd/admin-tier-main.go +++ b/cmd/admin-tier-main.go @@ -19,7 +19,6 @@ package cmd import ( "github.com/minio/cli" - "github.com/minio/pkg/console" ) var adminTierCmd = cli.Command{ @@ -28,12 +27,13 @@ var adminTierCmd = cli.Command{ Action: mainAdminTier, Before: setGlobalsFromContext, Flags: globalFlags, + Hidden: true, HideHelpCommand: true, Subcommands: adminTierDepCmds, } // mainAdminTier is the handle for "mc admin tier" command. func mainAdminTier(_ *cli.Context) error { - console.Println("Please use 'mc ilm tier' instead.") + deprecatedError("mc ilm tier") return nil } diff --git a/cmd/admin-top-api.go b/cmd/admin-top-api.go index 821a8d9b..96fdb5ff 100644 --- a/cmd/admin-top-api.go +++ b/cmd/admin-top-api.go @@ -19,7 +19,6 @@ package cmd import ( "github.com/minio/cli" - "github.com/minio/pkg/console" ) var adminTopAPIFlags = []cli.Flag{ @@ -48,12 +47,13 @@ var adminTopAPICmd = cli.Command{ OnUsageError: onUsageError, Before: setGlobalsFromContext, Flags: append(adminTopAPIFlags, globalFlags...), + Hidden: true, HideHelpCommand: true, CustomHelpTemplate: `Please use 'mc support top api' `, } func mainAdminTopAPI(_ *cli.Context) error { - console.Infoln("Please use 'mc support top api'") + deprecatedError("mc support top api") return nil } diff --git a/cmd/admin-top-locks.go b/cmd/admin-top-locks.go index 45161cd0..c79f7eac 100644 --- a/cmd/admin-top-locks.go +++ b/cmd/admin-top-locks.go @@ -19,7 +19,6 @@ package cmd import ( "github.com/minio/cli" - "github.com/minio/pkg/console" ) var topLocksFlag = []cli.Flag{ @@ -47,6 +46,6 @@ var adminTopLocksCmd = cli.Command{ } func mainAdminTopLocks(_ *cli.Context) error { - console.Infoln("Please use 'mc support top locks'") + deprecatedError("mc support top locks") return nil } diff --git a/cmd/error.go b/cmd/error.go index b2f02217..7431efd8 100644 --- a/cmd/error.go +++ b/cmd/error.go @@ -172,3 +172,9 @@ func errorIf(err *probe.Error, msg string, data ...interface{}) { } console.Errorln(fmt.Sprintf("%s %s", msg, err)) } + +// deprecatedError function for deprecated commands +func deprecatedError(newCommandName string) { + err := probe.NewError(fmt.Errorf("Please use '%s' instead", newCommandName)) + fatal(err, "Deprecated command") +} diff --git a/cmd/support-perf-object.go b/cmd/support-perf-object.go index a7ac1f2e..18e5ffb8 100644 --- a/cmd/support-perf-object.go +++ b/cmd/support-perf-object.go @@ -27,7 +27,6 @@ import ( "github.com/minio/cli" "github.com/minio/madmin-go/v2" "github.com/minio/mc/pkg/probe" - "github.com/minio/pkg/console" ) var adminSpeedtestCmd = cli.Command{ @@ -42,7 +41,7 @@ var adminSpeedtestCmd = cli.Command{ } func mainAdminSpeedtest(_ *cli.Context) error { - console.Infoln("Please use 'mc support perf'") + deprecatedError("mc support perf") return nil } diff --git a/cmd/support-register.go b/cmd/support-register.go index 86145328..f1f6e965 100644 --- a/cmd/support-register.go +++ b/cmd/support-register.go @@ -19,7 +19,6 @@ package cmd import ( "github.com/minio/cli" - "github.com/minio/pkg/console" ) var supportRegisterFlags = append([]cli.Flag{ @@ -40,6 +39,6 @@ var supportRegisterCmd = cli.Command{ } func mainSupportRegister(_ *cli.Context) error { - console.Infoln("Please use 'mc license register'") + deprecatedError("mc license register") return nil }