mirror of
https://github.com/minio/mc.git
synced 2025-07-30 07:23:03 +03:00
Add errors for deprecated commands (#4498)
This commit is contained in:
@ -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
|
||||
}
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -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.
|
||||
}
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -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")
|
||||
}
|
||||
|
@ -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
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
}
|
||||
|
Reference in New Issue
Block a user