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:
@@ -39,43 +39,43 @@ import (
|
||||
"github.com/containerd/platforms"
|
||||
"github.com/intel/goresctrl/pkg/blockio"
|
||||
"github.com/opencontainers/runtime-spec/specs-go"
|
||||
"github.com/urfave/cli"
|
||||
"github.com/urfave/cli/v2"
|
||||
"tags.cncf.io/container-device-interface/pkg/cdi"
|
||||
"tags.cncf.io/container-device-interface/pkg/parser"
|
||||
)
|
||||
|
||||
var platformRunFlags = []cli.Flag{
|
||||
cli.StringFlag{
|
||||
&cli.StringFlag{
|
||||
Name: "uidmap",
|
||||
Usage: "Run inside a user namespace with the specified UID mapping range; specified with the format `container-uid:host-uid:length`",
|
||||
},
|
||||
cli.StringFlag{
|
||||
&cli.StringFlag{
|
||||
Name: "gidmap",
|
||||
Usage: "Run inside a user namespace with the specified GID mapping range; specified with the format `container-gid:host-gid:length`",
|
||||
},
|
||||
cli.BoolFlag{
|
||||
&cli.BoolFlag{
|
||||
Name: "remap-labels",
|
||||
Usage: "Provide the user namespace ID remapping to the snapshotter via label options; requires snapshotter support",
|
||||
},
|
||||
cli.BoolFlag{
|
||||
&cli.BoolFlag{
|
||||
Name: "privileged-without-host-devices",
|
||||
Usage: "Don't pass all host devices to privileged container",
|
||||
},
|
||||
cli.Float64Flag{
|
||||
&cli.Float64Flag{
|
||||
Name: "cpus",
|
||||
Usage: "Set the CFS cpu quota",
|
||||
Value: 0.0,
|
||||
},
|
||||
cli.IntFlag{
|
||||
&cli.IntFlag{
|
||||
Name: "cpu-shares",
|
||||
Usage: "Set the cpu shares",
|
||||
Value: 1024,
|
||||
},
|
||||
cli.StringFlag{
|
||||
&cli.StringFlag{
|
||||
Name: "cpuset-cpus",
|
||||
Usage: "Set the CPUs the container will run in (e.g., 1-2,4)",
|
||||
},
|
||||
cli.StringFlag{
|
||||
&cli.StringFlag{
|
||||
Name: "cpuset-mems",
|
||||
Usage: "Set the memory nodes the container will run in (e.g., 1-2,4)",
|
||||
},
|
||||
@@ -110,7 +110,7 @@ func NewContainer(ctx gocontext.Context, client *containerd.Client, context *cli
|
||||
var (
|
||||
ref = context.Args().First()
|
||||
// for container's id is Args[1]
|
||||
args = context.Args()[2:]
|
||||
args = context.Args().Slice()[2:]
|
||||
)
|
||||
opts = append(opts, oci.WithDefaultSpec(), oci.WithDefaultUnixDevices)
|
||||
if ef := context.String("env-file"); ef != "" {
|
||||
|
||||
Reference in New Issue
Block a user