Skip to content

Commit

Permalink
set cobra.Command.Deprecated: "Deprecated - use ...
Browse files Browse the repository at this point in the history
ocm.CommonTransportFormat instead
  • Loading branch information
hilmarf committed Jan 14, 2025
1 parent 6fd914d commit 28e51bb
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
4 changes: 3 additions & 1 deletion cmds/ocm/commands/ocmcmds/componentarchive/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"github.com/spf13/cobra"

clictx "ocm.software/ocm/api/cli"
"ocm.software/ocm/api/ocm"
"ocm.software/ocm/cmds/ocm/commands/ocmcmds/componentarchive/create"
"ocm.software/ocm/cmds/ocm/commands/ocmcmds/componentarchive/transfer"
"ocm.software/ocm/cmds/ocm/commands/ocmcmds/names"
Expand All @@ -19,7 +20,8 @@ var Names = names.ComponentArchive
// NewCommand creates a new command.
func NewCommand(ctx clictx.Context) *cobra.Command {
cmd := utils.MassageCommand(&cobra.Command{
Short: "Commands acting on component archives",
Short: "Commands acting on component archives",
Deprecated: "Deprecated - use " + ocm.CommonTransportFormat + " instead",
}, Names...)
cmd.AddCommand(transfer.NewCommand(ctx, transfer.Verb))
cmd.AddCommand(create.NewCommand(ctx, create.Verb))
Expand Down
10 changes: 9 additions & 1 deletion cmds/ocm/commands/ocmcmds/componentarchive/create/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"github.com/spf13/pflag"

clictx "ocm.software/ocm/api/cli"
"ocm.software/ocm/api/ocm"
"ocm.software/ocm/api/ocm/compdesc"
metav1 "ocm.software/ocm/api/ocm/compdesc/meta/v1"
"ocm.software/ocm/api/ocm/extensions/attrs/compatattr"
Expand Down Expand Up @@ -53,7 +54,14 @@ type Command struct {
// Deprecated: Component Archive (CA) - https://kubernetes.slack.com/archives/C05UWBE8R1D/p1734357630853489
// NewCommand creates a new ctf command.
func NewCommand(ctx clictx.Context, names ...string) *cobra.Command {
return utils.SetupCommand(&Command{BaseCommand: utils.NewBaseCommand(ctx, formatoption.New(comparch.GetFormats()...), fileoption.NewCompArch(), schemaoption.New(compdesc.DefaultSchemeVersion))}, utils.Names(Names, names...)...)
c := utils.SetupCommand(
&Command{BaseCommand: utils.NewBaseCommand(ctx,
formatoption.New(comparch.GetFormats()...),
fileoption.NewCompArch(),
schemaoption.New(compdesc.DefaultSchemeVersion))},
utils.Names(Names, names...)...)
c.Deprecated = "Deprecated - use " + ocm.CommonTransportFormat + " instead"
return c
}

// Deprecated: Component Archive (CA) - https://kubernetes.slack.com/archives/C05UWBE8R1D/p1734357630853489
Expand Down
4 changes: 3 additions & 1 deletion cmds/ocm/commands/ocmcmds/componentarchive/transfer/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ type Command struct {
// Deprecated: Component Archive (CA) - https://kubernetes.slack.com/archives/C05UWBE8R1D/p1734357630853489
// NewCommand creates a new transfer command.
func NewCommand(ctx clictx.Context, names ...string) *cobra.Command {
return utils.SetupCommand(
c := utils.SetupCommand(
&Command{BaseCommand: utils.NewBaseCommand(ctx,
formatoption.New(),
lookupoption.New(),
Expand All @@ -50,6 +50,8 @@ func NewCommand(ctx clictx.Context, names ...string) *cobra.Command {
rscbyvalueoption.New(),
srcbyvalueoption.New(),
)}, utils.Names(Names, names...)...)
c.Deprecated = "Deprecated - use " + ocm.CommonTransportFormat + " instead"
return c
}

// Deprecated: Component Archive (CA) - https://kubernetes.slack.com/archives/C05UWBE8R1D/p1734357630853489
Expand Down

0 comments on commit 28e51bb

Please sign in to comment.