From 6021e7282f26606aef57927c4b5909daf0e9d1ca Mon Sep 17 00:00:00 2001 From: Michael Dwan Date: Tue, 29 Aug 2023 12:55:36 -0600 Subject: [PATCH] Add deprecation warnings, hide long deprecated commands --- internal/command/create/create.go | 2 +- internal/command/curl/curl.go | 2 ++ internal/command/destroy/destroy.go | 2 ++ internal/command/dnsrecords/root.go | 5 +++++ internal/command/domains/root.go | 2 ++ internal/command/move/move.go | 2 ++ internal/command/open/open.go | 5 ++++- internal/command/resume/resume.go | 2 ++ internal/command/suspend/suspend.go | 2 ++ 9 files changed, 22 insertions(+), 2 deletions(-) diff --git a/internal/command/create/create.go b/internal/command/create/create.go index dd3967f941..119fc14e72 100644 --- a/internal/command/create/create.go +++ b/internal/command/create/create.go @@ -10,7 +10,7 @@ func New() (cmd *cobra.Command) { cmd = &cobra.Command{ Use: "create", Hidden: true, - Deprecated: "replaced by 'apps create'", + Deprecated: "use `fly apps create` instead", } flag.Add(cmd, diff --git a/internal/command/curl/curl.go b/internal/command/curl/curl.go index 70972e4eba..1e3dbd52ed 100644 --- a/internal/command/curl/curl.go +++ b/internal/command/curl/curl.go @@ -37,6 +37,8 @@ func New() (cmd *cobra.Command) { cmd = command.New("curl ", short, long, run, command.RequireSession, ) + cmd.Deprecated = "`fly curl` will be removed in a future release" + cmd.Hidden = true cmd.Args = cobra.ExactArgs(1) diff --git a/internal/command/destroy/destroy.go b/internal/command/destroy/destroy.go index 40957ee4dc..4adc12d9ce 100644 --- a/internal/command/destroy/destroy.go +++ b/internal/command/destroy/destroy.go @@ -20,6 +20,8 @@ from the Fly platform. destroy := command.New(usage, short, long, apps.RunDestroy, command.RequireSession) + destroy.Hidden = true + destroy.Deprecated = "use `fly apps destroy` instead" destroy.Args = cobra.ExactArgs(1) diff --git a/internal/command/dnsrecords/root.go b/internal/command/dnsrecords/root.go index 90afeb156a..ab87a87758 100644 --- a/internal/command/dnsrecords/root.go +++ b/internal/command/dnsrecords/root.go @@ -24,6 +24,8 @@ func New() *cobra.Command { long = "Manage DNS records within a domain" ) cmd := command.New("dns-records", short, long, nil) + cmd.Deprecated = "`fly dns-records` will be removed in a future release" + cmd.Hidden = true cmd.AddCommand( newDNSRecordsList(), newDNSRecordsExport(), @@ -40,6 +42,7 @@ func newDNSRecordsList() *cobra.Command { cmd := command.New("list ", short, long, runDNSRecordsList, command.RequireSession, ) + cmd.Deprecated = "`fly dns-records list` will be removed in a future release" flag.Add(cmd, flag.JSONOutput(), ) @@ -55,6 +58,7 @@ func newDNSRecordsExport() *cobra.Command { cmd := command.New("export [filename]", short, long, runDNSRecordsExport, command.RequireSession, ) + cmd.Deprecated = "`fly dns-records export` will be removed in a future release" cmd.Args = cobra.RangeArgs(1, 2) return cmd } @@ -67,6 +71,7 @@ func newDNSRecordsImport() *cobra.Command { cmd := command.New("import [filename]", short, long, runDNSRecordsImport, command.RequireSession, ) + cmd.Deprecated = "`fly dns-records import` will be removed in a future release" cmd.Args = cobra.RangeArgs(1, 2) return cmd } diff --git a/internal/command/domains/root.go b/internal/command/domains/root.go index 4080640d8d..7238aa7531 100644 --- a/internal/command/domains/root.go +++ b/internal/command/domains/root.go @@ -28,6 +28,8 @@ Notice: this feature is deprecated and no longer supported. You can still view existing domains, but registration is no longer possible.` ) cmd := command.New("domains", short, long, nil) + cmd.Deprecated = "`fly domains` will be removed in a future release" + cmd.Hidden = true cmd.AddCommand( newDomainsList(), newDomainsShow(), diff --git a/internal/command/move/move.go b/internal/command/move/move.go index 8c38cb9c22..d67eac67f3 100644 --- a/internal/command/move/move.go +++ b/internal/command/move/move.go @@ -20,6 +20,8 @@ organization the current user belongs to. move := command.New(usage, short, long, apps.RunMove, command.RequireSession) + move.Hidden = true + move.Deprecated = "use `fly apps move` instead" move.Args = cobra.ExactArgs(1) diff --git a/internal/command/open/open.go b/internal/command/open/open.go index c0009a2968..2c22eed804 100644 --- a/internal/command/open/open.go +++ b/internal/command/open/open.go @@ -8,5 +8,8 @@ import ( // TODO: deprecate func New() *cobra.Command { - return apps.NewOpen() + cmd := apps.NewOpen() + cmd.Deprecated = "use `fly apps open` instead" + cmd.Hidden = true + return cmd } diff --git a/internal/command/resume/resume.go b/internal/command/resume/resume.go index 7ef6521889..d487843438 100644 --- a/internal/command/resume/resume.go +++ b/internal/command/resume/resume.go @@ -21,6 +21,8 @@ the number of configured instances. resume := command.New(usage, short, long, apps.RunResume, command.RequireSession) + resume.Hidden = true + resume.Deprecated = "use `fly scale count` instead" resume.Args = cobra.ExactArgs(1) diff --git a/internal/command/suspend/suspend.go b/internal/command/suspend/suspend.go index 44e2b7c4ec..d9c70227b6 100644 --- a/internal/command/suspend/suspend.go +++ b/internal/command/suspend/suspend.go @@ -21,6 +21,8 @@ for details on restarting it. suspend := command.New(usage, short, long, apps.RunSuspend, command.RequireSession) + suspend.Hidden = true + suspend.Deprecated = "use `fly scale count` instead" return suspend }