Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove unused archive flag from diff commands #14364

Merged
merged 1 commit into from
May 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions cmd/podman/containers/diff.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,9 @@ func init() {
Parent: containerCmd,
})

diffOpts = &entities.DiffOptions{}
diffOpts = new(entities.DiffOptions)
flags := diffCmd.Flags()

// FIXME: Why does this exists? It is not used anywhere.
flags.BoolVar(&diffOpts.Archive, "archive", true, "Save the diff as a tar archive")
_ = flags.MarkHidden("archive")

formatFlagName := "format"
flags.StringVar(&diffOpts.Format, formatFlagName, "", "Change the output format (json)")
_ = diffCmd.RegisterFlagCompletionFunc(formatFlagName, common.AutocompleteFormat(nil))
Expand Down
3 changes: 0 additions & 3 deletions cmd/podman/diff.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,6 @@ func init() {
Command: diffCmd,
})
flags := diffCmd.Flags()
// FIXME: Why does this exists? It is not used anywhere.
flags.BoolVar(&diffOpts.Archive, "archive", true, "Save the diff as a tar archive")
_ = flags.MarkHidden("archive")

formatFlagName := "format"
flags.StringVar(&diffOpts.Format, formatFlagName, "", "Change the output format (json)")
Expand Down
4 changes: 2 additions & 2 deletions cmd/podman/diff/diff.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
"github.com/spf13/cobra"
)

func Diff(cmd *cobra.Command, args []string, options entities.DiffOptions) error {
func Diff(_ *cobra.Command, args []string, options entities.DiffOptions) error {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we just drop this entirely? Or is it exposed externally and it would be an API break.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@TomSweeneyRedHat the cobra method signature requires this parameter.

results, err := registry.ContainerEngine().Diff(registry.GetContext(), args, options)
if err != nil {
return err
Expand Down Expand Up @@ -63,7 +63,7 @@ func changesToTable(diffs *entities.DiffReport) error {
return nil
}

// IDOrLatestArgs used to validate a nameOrId was provided or the "--latest" flag
// ValidateContainerDiffArgs used to validate a nameOrId was provided or the "--latest" flag
func ValidateContainerDiffArgs(cmd *cobra.Command, args []string) error {
given, _ := cmd.Flags().GetBool("latest")
if len(args) > 0 && !given {
Expand Down
4 changes: 1 addition & 3 deletions cmd/podman/images/diff.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,7 @@ func init() {
}

func diffFlags(flags *pflag.FlagSet) {
diffOpts = &entities.DiffOptions{}
flags.BoolVar(&diffOpts.Archive, "archive", true, "Save the diff as a tar archive")
_ = flags.MarkDeprecated("archive", "Provided for backwards compatibility, has no impact on output.")
diffOpts = new(entities.DiffOptions)

formatFlagName := "format"
flags.StringVar(&diffOpts.Format, formatFlagName, "", "Change the output format (json)")
Expand Down
7 changes: 3 additions & 4 deletions pkg/domain/entities/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,9 @@ type InspectOptions struct {

// DiffOptions all API and CLI diff commands and diff sub-commands use the same options
type DiffOptions struct {
Format string `json:",omitempty"` // CLI only
Latest bool `json:",omitempty"` // API and CLI, only supported by containers
Archive bool `json:",omitempty"` // CLI only
Type define.DiffType // Type which should be compared
Format string `json:",omitempty"` // CLI only
Latest bool `json:",omitempty"` // API and CLI, only supported by containers
Type define.DiffType // Type which should be compared
}

// DiffReport provides changes for object
Expand Down