cmd: don't alias context package, and use cliContext for cli.Context

Unfortunately, this is a rather large diff, but perhaps worth a one-time
"rip off the bandaid" for v2. This patch removes the use of "gocontext"
as alias for stdLib's "context", and uses "cliContext" for uses of
cli.context.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn
2024-06-20 02:15:13 +02:00
parent 741c4bde51
commit dd0542f7c1
65 changed files with 754 additions and 755 deletions

View File

@@ -187,13 +187,13 @@ func main() {
Value: "overlayfs",
},
}
app.Before = func(context *cli.Context) error {
if context.Bool("json") {
app.Before = func(cliContext *cli.Context) error {
if cliContext.Bool("json") {
if err := log.SetLevel("warn"); err != nil {
return err
}
}
if context.Bool("debug") {
if cliContext.Bool("debug") {
if err := log.SetLevel("debug"); err != nil {
return err
}
@@ -203,18 +203,18 @@ func main() {
app.Commands = []*cli.Command{
densityCommand,
}
app.Action = func(context *cli.Context) error {
app.Action = func(cliContext *cli.Context) error {
config := config{
Address: context.String("address"),
Duration: context.Duration("duration"),
Concurrency: context.Int("concurrent"),
CRI: context.Bool("cri"),
Exec: context.Bool("exec"),
Image: context.String("image"),
JSON: context.Bool("json"),
Metrics: context.String("metrics"),
Runtime: context.String("runtime"),
Snapshotter: context.String("snapshotter"),
Address: cliContext.String("address"),
Duration: cliContext.Duration("duration"),
Concurrency: cliContext.Int("concurrent"),
CRI: cliContext.Bool("cri"),
Exec: cliContext.Bool("exec"),
Image: cliContext.String("image"),
JSON: cliContext.Bool("json"),
Metrics: cliContext.String("metrics"),
Runtime: cliContext.String("runtime"),
Snapshotter: cliContext.String("snapshotter"),
}
if config.Metrics != "" {
return serve(config)