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

@@ -60,18 +60,18 @@ var listCommand = &cli.Command{
Usage: "Print detailed information about each plugin",
},
},
Action: func(context *cli.Context) error {
Action: func(cliContext *cli.Context) error {
var (
quiet = context.Bool("quiet")
detailed = context.Bool("detailed")
quiet = cliContext.Bool("quiet")
detailed = cliContext.Bool("detailed")
)
client, ctx, cancel, err := commands.NewClient(context)
client, ctx, cancel, err := commands.NewClient(cliContext)
if err != nil {
return err
}
defer cancel()
ps := client.IntrospectionService()
response, err := ps.Plugins(ctx, context.Args().Slice()...)
response, err := ps.Plugins(ctx, cliContext.Args().Slice()...)
if err != nil {
return err
}
@@ -172,13 +172,13 @@ var inspectRuntimeCommand = &cli.Command{
Usage: "Display runtime info",
ArgsUsage: "[flags]",
Flags: commands.RuntimeFlags,
Action: func(context *cli.Context) error {
rt := context.String("runtime")
rtOptions, err := commands.RuntimeOptions(context)
Action: func(cliContext *cli.Context) error {
rt := cliContext.String("runtime")
rtOptions, err := commands.RuntimeOptions(cliContext)
if err != nil {
return err
}
client, ctx, cancel, err := commands.NewClient(context)
client, ctx, cancel, err := commands.NewClient(cliContext)
if err != nil {
return err
}
@@ -191,7 +191,7 @@ var inspectRuntimeCommand = &cli.Command{
if err != nil {
return err
}
_, err = fmt.Fprintln(context.App.Writer, string(j))
_, err = fmt.Fprintln(cliContext.App.Writer, string(j))
return err
},
}