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

@@ -23,37 +23,37 @@ import (
"github.com/containerd/containerd/v2/core/runtime/v2/runc/options"
runtimeoptions "github.com/containerd/containerd/v2/pkg/runtimeoptions/v1"
"github.com/urfave/cli"
"github.com/urfave/cli/v2"
)
func init() {
RuntimeFlags = append(RuntimeFlags, cli.StringFlag{
RuntimeFlags = append(RuntimeFlags, &cli.StringFlag{
Name: "runc-binary",
Usage: "Specify runc-compatible binary",
}, cli.StringFlag{
}, &cli.StringFlag{
Name: "runc-root",
Usage: "Specify runc-compatible root",
}, cli.BoolFlag{
}, &cli.BoolFlag{
Name: "runc-systemd-cgroup",
Usage: "Start runc with systemd cgroup manager",
})
ContainerFlags = append(ContainerFlags, cli.BoolFlag{
ContainerFlags = append(ContainerFlags, &cli.BoolFlag{
Name: "rootfs",
Usage: "Use custom rootfs that is not managed by containerd snapshotter",
}, cli.BoolFlag{
}, &cli.BoolFlag{
Name: "no-pivot",
Usage: "Disable use of pivot-root (linux only)",
}, cli.Int64Flag{
}, &cli.Int64Flag{
Name: "cpu-quota",
Usage: "Limit CPU CFS quota",
Value: -1,
}, cli.Uint64Flag{
}, &cli.Uint64Flag{
Name: "cpu-period",
Usage: "Limit CPU CFS period",
}, cli.StringFlag{
}, &cli.StringFlag{
Name: "rootfs-propagation",
Usage: "Set the propagation of the container rootfs",
}, cli.StringSliceFlag{
}, &cli.StringSliceFlag{
Name: "device",
Usage: "File path to a device to add to the container; or a path to a directory tree of devices to add to the container",
})