mirror of
https://github.com/containers/podman.git
synced 2025-10-17 11:14:40 +08:00
Merge pull request #23043 from miyamo2/feat/issues#23038
fix(diff): do not suggest `--latest` when runs on remote with no args
This commit is contained in:
@ -73,6 +73,9 @@ func ValidateContainerDiffArgs(cmd *cobra.Command, args []string) error {
|
||||
return errors.New("--latest and containers cannot be used together")
|
||||
}
|
||||
if len(args) == 0 && !given {
|
||||
if registry.IsRemote() {
|
||||
return fmt.Errorf("%q requires a name or id", cmd.CommandPath())
|
||||
}
|
||||
return fmt.Errorf("%q requires a name, id, or the \"--latest\" flag", cmd.CommandPath())
|
||||
}
|
||||
return nil
|
||||
|
@ -165,4 +165,13 @@ RUN touch %s`, ALPINE, imagefile)
|
||||
Expect(session.OutputToString()).To(ContainSubstring(confile))
|
||||
})
|
||||
|
||||
It("podman diff without args", func() {
|
||||
session := podmanTest.Podman([]string{"diff"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
if IsRemote() {
|
||||
Expect(session).Should(ExitWithError(125, " requires a name or id"))
|
||||
} else {
|
||||
Expect(session).Should(ExitWithError(125, " requires a name, id, or the \"--latest\" flag"))
|
||||
}
|
||||
})
|
||||
})
|
||||
|
Reference in New Issue
Block a user