mirror of
https://github.com/containers/skopeo.git
synced 2025-09-18 07:54:32 +00:00
Drop the *cli.Context argument from parseImage and parseImageSource
We no longer need it for handling flags. Also, require the caller to explicitly pass an image name to parseImage instead of, horribly nontransparently, using the first CLI option. Signed-off-by: Miloslav Trmač <mitr@redhat.com>
This commit is contained in:
@@ -69,7 +69,7 @@ func (opts *inspectOptions) run(c *cli.Context) (retErr error) {
|
||||
ctx, cancel := opts.global.commandTimeoutContext()
|
||||
defer cancel()
|
||||
|
||||
img, err := parseImage(ctx, c, opts.image)
|
||||
img, err := parseImage(ctx, opts.image, c.Args().First())
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
@@ -51,7 +51,7 @@ func (opts *layersOptions) run(c *cli.Context) (retErr error) {
|
||||
return err
|
||||
}
|
||||
cache := blobinfocache.DefaultCache(sys)
|
||||
rawSource, err := parseImageSource(ctx, c, opts.image, c.Args()[0])
|
||||
rawSource, err := parseImageSource(ctx, opts.image, c.Args()[0])
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
@@ -182,9 +182,8 @@ func getDockerAuth(creds string) (*types.DockerAuthConfig, error) {
|
||||
|
||||
// parseImage converts image URL-like string to an initialized handler for that image.
|
||||
// The caller must call .Close() on the returned ImageCloser.
|
||||
func parseImage(ctx context.Context, c *cli.Context, opts *imageOptions) (types.ImageCloser, error) {
|
||||
imgName := c.Args().First()
|
||||
ref, err := alltransports.ParseImageName(imgName)
|
||||
func parseImage(ctx context.Context, opts *imageOptions, name string) (types.ImageCloser, error) {
|
||||
ref, err := alltransports.ParseImageName(name)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -197,7 +196,7 @@ func parseImage(ctx context.Context, c *cli.Context, opts *imageOptions) (types.
|
||||
|
||||
// parseImageSource converts image URL-like string to an ImageSource.
|
||||
// The caller must call .Close() on the returned ImageSource.
|
||||
func parseImageSource(ctx context.Context, c *cli.Context, opts *imageOptions, name string) (types.ImageSource, error) {
|
||||
func parseImageSource(ctx context.Context, opts *imageOptions, name string) (types.ImageSource, error) {
|
||||
ref, err := alltransports.ParseImageName(name)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
Reference in New Issue
Block a user