Convert CLI to urfave v2

Followed the Migration Guide at https://cli.urfave.org/migrate-v1-to-v2/
The major changes not pointed out in the migration guide are:
- context.Args() no longer produces a []slice, so context.Args().Slice()
  in substitued
- All cli.Global***** are deprecated (the migration guide is somewhat
  unclear on this)

Signed-off-by: Derek Nola <derek.nola@suse.com>

Vendor in urfave cli/v2

Signed-off-by: Derek Nola <derek.nola@suse.com>

Fix NewStringSlice calls

Signed-off-by: Derek Nola <derek.nola@suse.com>
This commit is contained in:
Derek Nola
2024-02-12 10:51:13 -08:00
parent d4d228926c
commit 132485adb0
149 changed files with 11041 additions and 4693 deletions

View File

@@ -40,11 +40,11 @@ import (
"github.com/containerd/platforms"
digest "github.com/opencontainers/go-digest"
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
"github.com/urfave/cli"
"github.com/urfave/cli/v2"
"golang.org/x/sync/errgroup"
)
var pushCommand = cli.Command{
var pushCommand = &cli.Command{
Name: "push",
Usage: "Push an image to a remote",
ArgsUsage: "[flags] <remote> [<local>]",
@@ -57,24 +57,24 @@ var pushCommand = cli.Command{
creating the associated configuration, and creating the manifest
which references those resources.
`,
Flags: append(commands.RegistryFlags, cli.StringFlag{
Flags: append(commands.RegistryFlags, &cli.StringFlag{
Name: "manifest",
Usage: "Digest of manifest",
}, cli.StringFlag{
}, &cli.StringFlag{
Name: "manifest-type",
Usage: "Media type of manifest digest",
Value: ocispec.MediaTypeImageManifest,
}, cli.StringSliceFlag{
}, &cli.StringSliceFlag{
Name: "platform",
Usage: "Push content from a specific platform",
Value: &cli.StringSlice{},
}, cli.IntFlag{
Value: cli.NewStringSlice(),
}, &cli.IntFlag{
Name: "max-concurrent-uploaded-layers",
Usage: "Set the max concurrent uploaded layers for each push",
}, cli.BoolFlag{
}, &cli.BoolFlag{
Name: "local",
Usage: "Push content from local client rather than using transfer service",
}, cli.BoolFlag{
}, &cli.BoolFlag{
Name: "allow-non-distributable-blobs",
Usage: "Allow pushing blobs that are marked as non-distributable",
}),
@@ -82,7 +82,7 @@ var pushCommand = cli.Command{
var (
ref = context.Args().First()
local = context.Args().Get(1)
debug = context.GlobalBool("debug")
debug = context.Bool("debug")
desc ocispec.Descriptor
)
if ref == "" {