Update pull command to use filter arguments
Signed-off-by: Derek McGowan <derek@mcg.dev>
This commit is contained in:
parent
40d3fa3afd
commit
b991c71e90
@ -97,8 +97,36 @@ command. As part of this process, we do the following:
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var sopts []image.StoreOpt
|
||||||
|
if !context.Bool("all-platforms") {
|
||||||
|
var p []ocispec.Platform
|
||||||
|
for _, s := range context.StringSlice("platform") {
|
||||||
|
ps, err := platforms.Parse(s)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("unable to parse platform %s: %w", s, err)
|
||||||
|
}
|
||||||
|
p = append(p, ps)
|
||||||
|
}
|
||||||
|
if len(p) == 0 {
|
||||||
|
p = append(p, platforms.DefaultSpec())
|
||||||
|
}
|
||||||
|
sopts = append(sopts, image.WithPlatforms(p...))
|
||||||
|
}
|
||||||
|
// TODO: Support unpack for all platforms..?
|
||||||
|
// Pass in a *?
|
||||||
|
|
||||||
|
if context.Bool("metadata-only") {
|
||||||
|
sopts = append(sopts, image.WithAllMetadata)
|
||||||
|
// Any with an empty set is None
|
||||||
|
// TODO: Specify way to specify not default platorm
|
||||||
|
//config.PlatformMatcher = platforms.Any()
|
||||||
|
} else if context.Bool("all-metadata") {
|
||||||
|
sopts = append(sopts, image.WithAllMetadata)
|
||||||
|
}
|
||||||
|
|
||||||
reg := image.NewOCIRegistry(ref, nil, ch)
|
reg := image.NewOCIRegistry(ref, nil, ch)
|
||||||
is := image.NewStore(ref)
|
is := image.NewStore(ref, sopts...)
|
||||||
|
|
||||||
pf, done := ProgressHandler(ctx, os.Stdout)
|
pf, done := ProgressHandler(ctx, os.Stdout)
|
||||||
defer done()
|
defer done()
|
||||||
|
Loading…
Reference in New Issue
Block a user