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

@@ -38,15 +38,15 @@ var unmountCommand = &cli.Command{
Usage: "Remove the snapshot after a successful unmount",
},
),
Action: func(context *cli.Context) error {
Action: func(cliContext *cli.Context) error {
var (
target = context.Args().First()
target = cliContext.Args().First()
)
if target == "" {
return errors.New("please provide a target path to unmount from")
}
client, ctx, cancel, err := commands.NewClient(context)
client, ctx, cancel, err := commands.NewClient(cliContext)
if err != nil {
return err
}
@@ -56,8 +56,8 @@ var unmountCommand = &cli.Command{
return err
}
if context.Bool("rm") {
snapshotter := context.String("snapshotter")
if cliContext.Bool("rm") {
snapshotter := cliContext.String("snapshotter")
s := client.SnapshotService(snapshotter)
if err := client.LeasesService().Delete(ctx, leases.Lease{ID: target}); err != nil && !errdefs.IsNotFound(err) {
return fmt.Errorf("error deleting lease: %w", err)
@@ -67,7 +67,7 @@ var unmountCommand = &cli.Command{
}
}
fmt.Fprintln(context.App.Writer, target)
fmt.Fprintln(cliContext.App.Writer, target)
return nil
},
}