mirror of https://github.com/containers/podman.git
				
				
				
			
						commit
						5cba4dc2e4
					
				|  | @ -1,6 +1,7 @@ | ||||||
| package main | package main | ||||||
| 
 | 
 | ||||||
| import ( | import ( | ||||||
|  | 	"errors" | ||||||
| 	"fmt" | 	"fmt" | ||||||
| 	"os" | 	"os" | ||||||
| 
 | 
 | ||||||
|  | @ -26,6 +27,7 @@ import ( | ||||||
| 	"github.com/containers/storage/pkg/reexec" | 	"github.com/containers/storage/pkg/reexec" | ||||||
| 	"github.com/sirupsen/logrus" | 	"github.com/sirupsen/logrus" | ||||||
| 	"github.com/spf13/cobra" | 	"github.com/spf13/cobra" | ||||||
|  | 	"github.com/spf13/pflag" | ||||||
| ) | ) | ||||||
| 
 | 
 | ||||||
| func main() { | func main() { | ||||||
|  | @ -101,6 +103,13 @@ func parseCommands() *cobra.Command { | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| func flagErrorFuncfunc(c *cobra.Command, e error) error { | func flagErrorFuncfunc(c *cobra.Command, e error) error { | ||||||
|  | 	// cobra compares via == and not errors.Is so we cannot wrap that error.
 | ||||||
|  | 	// This is required to make podman -h work.
 | ||||||
|  | 	// This can be removed once https://github.com/spf13/cobra/pull/1730
 | ||||||
|  | 	// is merged and vendored into podman.
 | ||||||
|  | 	if errors.Is(e, pflag.ErrHelp) { | ||||||
|  | 		return e | ||||||
|  | 	} | ||||||
| 	e = fmt.Errorf("%w\nSee '%s --help'", e, c.CommandPath()) | 	e = fmt.Errorf("%w\nSee '%s --help'", e, c.CommandPath()) | ||||||
| 	return e | 	return e | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -199,7 +199,7 @@ function check_help() { | ||||||
|     check_help |     check_help | ||||||
| 
 | 
 | ||||||
|     # Test for regression of #7273 (spurious "--remote" help on output) |     # Test for regression of #7273 (spurious "--remote" help on output) | ||||||
|     for helpopt in help --help; do |     for helpopt in help --help -h; do | ||||||
|         run_podman $helpopt |         run_podman $helpopt | ||||||
|         is "${lines[0]}" "Manage pods, containers and images" \ |         is "${lines[0]}" "Manage pods, containers and images" \ | ||||||
|            "podman $helpopt: first line of output" |            "podman $helpopt: first line of output" | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue