From 05af53e75c53d484ab603a82b912742f2bb72316 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 30 Sep 2025 05:52:14 +0000 Subject: [PATCH 01/23] Initial plan From 783fe5b276a83cb99b9414cb8afdec2f63c30bd6 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 30 Sep 2025 06:08:40 +0000 Subject: [PATCH 02/23] Upgrade urfave/cli from v2 to v3 to support flags after arguments Co-authored-by: aooohan <40265686+aooohan@users.noreply.github.com> --- cmd/cmd.go | 21 +++++++++++---------- cmd/commands/activate.go | 11 ++++++----- cmd/commands/add.go | 11 ++++++----- cmd/commands/available.go | 7 ++++--- cmd/commands/cd.go | 11 ++++++----- cmd/commands/config.go | 13 +++++++------ cmd/commands/current.go | 7 ++++--- cmd/commands/env.go | 19 ++++++++++--------- cmd/commands/info.go | 25 +++++++++++++------------ cmd/commands/install.go | 11 ++++++----- cmd/commands/list.go | 7 ++++--- cmd/commands/remove.go | 7 ++++--- cmd/commands/search.go | 9 +++++---- cmd/commands/uninstall.go | 7 ++++--- cmd/commands/unuse.go | 11 ++++++----- cmd/commands/update.go | 9 +++++---- cmd/commands/upgrade.go | 7 ++++--- cmd/commands/upgrade_win.go | 1 + cmd/commands/use.go | 11 ++++++----- go.mod | 5 +---- go.sum | 10 ++-------- internal/manager.go | 2 +- 22 files changed, 116 insertions(+), 106 deletions(-) diff --git a/cmd/cmd.go b/cmd/cmd.go index be876846..87df848d 100644 --- a/cmd/cmd.go +++ b/cmd/cmd.go @@ -17,10 +17,11 @@ package cmd import ( + "context" "fmt" "os" - "github.com/urfave/cli/v2" + "github.com/urfave/cli/v3" "github.com/version-fox/vfox/cmd/commands" "github.com/version-fox/vfox/internal" "github.com/version-fox/vfox/internal/logger" @@ -31,12 +32,12 @@ func Execute(args []string) { } type cmd struct { - app *cli.App + app *cli.Command version string } func (c *cmd) Execute(args []string) { - if err := c.app.Run(args); err != nil { + if err := c.app.Run(context.Background(), args); err != nil { fmt.Println(err) os.Exit(1) } @@ -48,14 +49,14 @@ func newCmd() *cmd { Name: "version", Aliases: []string{"v", "V"}, Usage: "print version", - Action: func(ctx *cli.Context, b bool) error { + Action: func(ctx context.Context, cmd *cli.Command, b bool) error { println(version) return nil }, } - app := &cli.App{} - app.EnableBashCompletion = true + app := &cli.Command{} + app.EnableShellCompletion = true app.Name = "vfox" app.Usage = "vfox is a tool for runtime version management." app.UsageText = "vfox [command] [command options]" @@ -63,16 +64,16 @@ func newCmd() *cmd { app.Version = version app.Description = "vfox is a cross-platform version manager, extendable via plugins. It allows you to quickly install and switch between different environment you need via the command line." app.Suggest = true - app.BashComplete = func(ctx *cli.Context) { - for _, command := range ctx.App.Commands { - _, _ = fmt.Fprintln(ctx.App.Writer, command.Name) + app.ShellComplete = func(ctx context.Context, cmd *cli.Command) { + for _, command := range cmd.Commands { + _, _ = fmt.Fprintln(cmd.Writer, command.Name) } } debugFlags := &cli.BoolFlag{ Name: "debug", Usage: "show debug information", - Action: func(ctx *cli.Context, b bool) error { + Action: func(ctx context.Context, cmd *cli.Command, b bool) error { logger.SetLevel(logger.DebugLevel) return nil }, diff --git a/cmd/commands/activate.go b/cmd/commands/activate.go index 746f20ab..57cea136 100644 --- a/cmd/commands/activate.go +++ b/cmd/commands/activate.go @@ -17,6 +17,7 @@ package commands import ( +"context" "fmt" "os" "strings" @@ -24,7 +25,7 @@ import ( "github.com/version-fox/vfox/internal" - "github.com/urfave/cli/v2" + "github.com/urfave/cli/v3" "github.com/version-fox/vfox/internal/env" "github.com/version-fox/vfox/internal/shell" ) @@ -36,8 +37,8 @@ var Activate = &cli.Command{ Category: CategorySDK, } -func activateCmd(ctx *cli.Context) error { - name := ctx.Args().First() +func activateCmd(ctx context.Context, cmd *cli.Command) error { + name := cmd.Args().First() if name == "" { return cli.Exit("shell name is required", 1) } @@ -70,7 +71,7 @@ func activateCmd(ctx *cli.Context) error { str, err := s.Activate( shell.ActivateConfig{ SelfPath: path, - Args: ctx.Args().Tail(), + Args: cmd.Args().Tail(), }, ) if err != nil { @@ -87,5 +88,5 @@ func activateCmd(ctx *cli.Context) error { SelfPath: path, EnvContent: exportStr, } - return hookTemplate.Execute(ctx.App.Writer, tmpCtx) + return hookTemplate.Execute(cmd.Writer, tmpCtx) } diff --git a/cmd/commands/add.go b/cmd/commands/add.go index 64a30802..ed911ee0 100644 --- a/cmd/commands/add.go +++ b/cmd/commands/add.go @@ -17,10 +17,11 @@ package commands import ( +"context" "fmt" "github.com/pterm/pterm" - "github.com/urfave/cli/v2" + "github.com/urfave/cli/v3" "github.com/version-fox/vfox/internal" ) @@ -43,8 +44,8 @@ var Add = &cli.Command{ } // addCmd is the command to add a plugin of sdk -func addCmd(ctx *cli.Context) error { - args := ctx.Args() +func addCmd(ctx context.Context, cmd *cli.Command) error { + args := cmd.Args() manager := internal.NewSdkManager() defer manager.Close() @@ -60,8 +61,8 @@ func addCmd(ctx *cli.Context) error { return nil } else { sdkName := args.First() - source := ctx.String("source") - alias := ctx.String("alias") + source := cmd.String("source") + alias := cmd.String("alias") err := manager.Add(sdkName, source, alias) if err == nil { pterm.Printf("Please use `%s` to install the version you need.\n", pterm.LightBlue(fmt.Sprintf("vfox install %s@", sdkName))) diff --git a/cmd/commands/available.go b/cmd/commands/available.go index ccf38823..cee19a7e 100644 --- a/cmd/commands/available.go +++ b/cmd/commands/available.go @@ -17,10 +17,11 @@ package commands import ( +"context" "strings" "github.com/pterm/pterm" - "github.com/urfave/cli/v2" + "github.com/urfave/cli/v3" "github.com/version-fox/vfox/internal" ) @@ -31,10 +32,10 @@ var Available = &cli.Command{ Category: CategoryPlugin, } -func availableCmd(ctx *cli.Context) error { +func availableCmd(ctx context.Context, cmd *cli.Command) error { manager := internal.NewSdkManager() defer manager.Close() - //categoryName := ctx.Args().First() + //categoryName := cmd.Args().First() available, err := manager.Available() if err != nil { return err diff --git a/cmd/commands/cd.go b/cmd/commands/cd.go index 89ad727a..f9efc0ca 100644 --- a/cmd/commands/cd.go +++ b/cmd/commands/cd.go @@ -1,10 +1,11 @@ package commands import ( +"context" "fmt" "os" - "github.com/urfave/cli/v2" + "github.com/urfave/cli/v3" "github.com/version-fox/vfox/internal" "github.com/version-fox/vfox/internal/env" "github.com/version-fox/vfox/internal/shell" @@ -23,19 +24,19 @@ var Cd = &cli.Command{ Action: cdCmd, } -func cdCmd(ctx *cli.Context) error { +func cdCmd(ctx context.Context, cmd *cli.Command) error { var dir string manager := internal.NewSdkManager() - if ctx.Args().Len() == 0 { + if cmd.Args().Len() == 0 { dir = manager.PathMeta.HomePath } else { - sdkName := ctx.Args().First() + sdkName := cmd.Args().First() sdk, err := manager.LookupSdk(sdkName) if err != nil { return err } - if ctx.Bool("plugin") { + if cmd.Bool("plugin") { dir = sdk.Plugin.Path } else { current := sdk.Current() diff --git a/cmd/commands/config.go b/cmd/commands/config.go index 5ec82607..04787262 100644 --- a/cmd/commands/config.go +++ b/cmd/commands/config.go @@ -1,6 +1,7 @@ package commands import ( +"context" "errors" "fmt" "github.com/version-fox/vfox/internal/config" @@ -9,7 +10,7 @@ import ( "strings" "time" - "github.com/urfave/cli/v2" + "github.com/urfave/cli/v3" "github.com/version-fox/vfox/internal" ) @@ -31,23 +32,23 @@ var Config = &cli.Command{ Action: configCmd, } -func configCmd(ctx *cli.Context) error { +func configCmd(ctx context.Context, cmd *cli.Command) error { manager := internal.NewSdkManager() defer manager.Close() conf := reflect.ValueOf(manager.Config) - if ctx.Bool("list") { + if cmd.Bool("list") { configList("", conf) return nil } - args := ctx.Args() + args := cmd.Args() if args.Len() == 0 { - return ctx.App.Run([]string{"CMD", "config", "-h"}) + return cmd.Run(ctx, []string{"CMD", "config", "-h"}) } keys := strings.Split(args.First(), ".") - unset := ctx.Bool("unset") + unset := cmd.Bool("unset") if !unset && args.Len() == 1 { configGet(conf, keys) return nil diff --git a/cmd/commands/current.go b/cmd/commands/current.go index 0bb33489..68180403 100644 --- a/cmd/commands/current.go +++ b/cmd/commands/current.go @@ -17,10 +17,11 @@ package commands import ( +"context" "fmt" "github.com/pterm/pterm" - "github.com/urfave/cli/v2" + "github.com/urfave/cli/v3" "github.com/version-fox/vfox/internal" ) @@ -33,10 +34,10 @@ var Current = &cli.Command{ Category: CategorySDK, } -func currentCmd(ctx *cli.Context) error { +func currentCmd(ctx context.Context, cmd *cli.Command) error { manager := internal.NewSdkManager() defer manager.Close() - sdkName := ctx.Args().First() + sdkName := cmd.Args().First() if sdkName == "" { allSdk, err := manager.LoadAllSdk() if err != nil { diff --git a/cmd/commands/env.go b/cmd/commands/env.go index d59a17ce..de430e5b 100644 --- a/cmd/commands/env.go +++ b/cmd/commands/env.go @@ -17,10 +17,11 @@ package commands import ( +"context" "encoding/json" "fmt" - "github.com/urfave/cli/v2" + "github.com/urfave/cli/v3" "github.com/version-fox/vfox/internal" "github.com/version-fox/vfox/internal/base" "github.com/version-fox/vfox/internal/env" @@ -55,15 +56,15 @@ var Env = &cli.Command{ Category: CategorySDK, } -func envCmd(ctx *cli.Context) error { - if ctx.IsSet("json") { +func envCmd(ctx context.Context, cmd *cli.Command) error { + if cmd.IsSet("json") { return outputJSON() - } else if ctx.IsSet("cleanup") { + } else if cmd.IsSet("cleanup") { return cleanTmp() - } else if ctx.IsSet("full") { - return envFlag(ctx, "full") + } else if cmd.IsSet("full") { + return envFlag(cmd, "full") } else { - return envFlag(ctx, "cwd") + return envFlag(cmd, "cwd") } } @@ -114,8 +115,8 @@ func cleanTmp() error { return nil } -func envFlag(ctx *cli.Context, mode string) error { - shellName := ctx.String("shell") +func envFlag(cmd *cli.Command, mode string) error { + shellName := cmd.String("shell") if shellName == "" { return cli.Exit("shell name is required", 1) } diff --git a/cmd/commands/info.go b/cmd/commands/info.go index 5bf6de7a..14399bcd 100644 --- a/cmd/commands/info.go +++ b/cmd/commands/info.go @@ -17,13 +17,14 @@ package commands import ( +"context" "fmt" "path/filepath" "strings" "text/template" "github.com/pterm/pterm" - "github.com/urfave/cli/v2" + "github.com/urfave/cli/v3" "github.com/version-fox/vfox/internal" "github.com/version-fox/vfox/internal/base" ) @@ -43,10 +44,10 @@ var Info = &cli.Command{ }, } -func infoCmd(ctx *cli.Context) error { +func infoCmd(ctx context.Context, cmd *cli.Command) error { manager := internal.NewSdkManager() defer manager.Close() - args := ctx.Args().First() + args := cmd.Args().First() if args == "" { return cli.Exit("invalid arguments", 1) } @@ -62,7 +63,7 @@ func infoCmd(ctx *cli.Context) error { if name != "" && string(version) != "" { sdk, err := manager.LookupSdk(name) if err != nil { - if ctx.IsSet("format") { + if cmd.IsSet("format") { // For template output, we still need to output something data := struct { Name string @@ -73,7 +74,7 @@ func infoCmd(ctx *cli.Context) error { Version: string(version), Path: "notfound", } - return executeTemplate(ctx, data) + return executeTemplate(cmd, data) } fmt.Println("notfound") return nil @@ -87,7 +88,7 @@ func infoCmd(ctx *cli.Context) error { } // Check if format flag is set - formatValue := ctx.String("format") + formatValue := cmd.String("format") if formatValue != "" { data := struct { Name string @@ -98,7 +99,7 @@ func infoCmd(ctx *cli.Context) error { Version: string(version), Path: path, } - return executeTemplate(ctx, data) + return executeTemplate(cmd, data) } fmt.Println(path) @@ -115,7 +116,7 @@ func infoCmd(ctx *cli.Context) error { source := s.Plugin // If format flag is set, prepare data for template - if ctx.IsSet("format") { + if cmd.IsSet("format") { data := struct { Name string Version string @@ -129,7 +130,7 @@ func infoCmd(ctx *cli.Context) error { InstallPath: s.InstallPath, Description: source.Description, } - return executeTemplate(ctx, data) + return executeTemplate(cmd, data) } pterm.Println("Plugin Info:") @@ -142,11 +143,11 @@ func infoCmd(ctx *cli.Context) error { return nil } -func executeTemplate(ctx *cli.Context, data interface{}) error { - tmplStr := ctx.String("format") +func executeTemplate(cmd *cli.Command, data interface{}) error { + tmplStr := cmd.String("format") tmpl, err := template.New("format").Parse(tmplStr) if err != nil { return fmt.Errorf("error parsing template: %w", err) } - return tmpl.Execute(ctx.App.Writer, data) + return tmpl.Execute(cmd.Writer, data) } diff --git a/cmd/commands/install.go b/cmd/commands/install.go index 2fff7f30..518f38e7 100644 --- a/cmd/commands/install.go +++ b/cmd/commands/install.go @@ -17,13 +17,14 @@ package commands import ( +"context" "errors" "fmt" "os" "strings" "github.com/pterm/pterm" - "github.com/urfave/cli/v2" + "github.com/urfave/cli/v3" "github.com/version-fox/vfox/internal" "github.com/version-fox/vfox/internal/base" "github.com/version-fox/vfox/internal/logger" @@ -51,14 +52,14 @@ var Install = &cli.Command{ Category: CategorySDK, } -func installCmd(ctx *cli.Context) error { - yes := ctx.Bool("yes") +func installCmd(ctx context.Context, cmd *cli.Command) error { + yes := cmd.Bool("yes") - if ctx.Bool("all") { + if cmd.Bool("all") { return installAll(yes) } - args := ctx.Args() + args := cmd.Args() if args.First() == "" { return cli.Exit("sdk name is required", 1) } diff --git a/cmd/commands/list.go b/cmd/commands/list.go index 976f8c5e..05300b13 100644 --- a/cmd/commands/list.go +++ b/cmd/commands/list.go @@ -17,11 +17,12 @@ package commands import ( +"context" "fmt" "github.com/pterm/pterm" "github.com/pterm/pterm/putils" - "github.com/urfave/cli/v2" + "github.com/urfave/cli/v3" "github.com/version-fox/vfox/internal" ) @@ -33,10 +34,10 @@ var List = &cli.Command{ Category: CategorySDK, } -func listCmd(ctx *cli.Context) error { +func listCmd(ctx context.Context, cmd *cli.Command) error { manager := internal.NewSdkManager() defer manager.Close() - sdkName := ctx.Args().First() + sdkName := cmd.Args().First() if sdkName == "" { allSdk, err := manager.LoadAllSdk() if err != nil { diff --git a/cmd/commands/remove.go b/cmd/commands/remove.go index 41e5290c..2537f958 100644 --- a/cmd/commands/remove.go +++ b/cmd/commands/remove.go @@ -17,8 +17,9 @@ package commands import ( +"context" "github.com/pterm/pterm" - "github.com/urfave/cli/v2" + "github.com/urfave/cli/v3" "github.com/version-fox/vfox/internal" ) @@ -29,8 +30,8 @@ var Remove = &cli.Command{ Category: CategoryPlugin, } -func removeCmd(ctx *cli.Context) error { - args := ctx.Args() +func removeCmd(ctx context.Context, cmd *cli.Command) error { + args := cmd.Args() l := args.Len() if l < 1 { return cli.Exit("invalid arguments", 1) diff --git a/cmd/commands/search.go b/cmd/commands/search.go index 9a62f3d8..bb75190b 100644 --- a/cmd/commands/search.go +++ b/cmd/commands/search.go @@ -17,12 +17,13 @@ package commands import ( +"context" "fmt" "math" "os" "strings" - "github.com/urfave/cli/v2" + "github.com/urfave/cli/v3" "github.com/version-fox/vfox/internal" "github.com/version-fox/vfox/internal/base" "github.com/version-fox/vfox/internal/printer" @@ -110,10 +111,10 @@ func RunSearch(sdkName string, availableArgs []string) error { return source.Install(base.Version(version.Key)) } -func searchCmd(ctx *cli.Context) error { - sdkName := ctx.Args().First() +func searchCmd(ctx context.Context, cmd *cli.Command) error { + sdkName := cmd.Args().First() if sdkName == "" { return cli.Exit("sdk name is required", 1) } - return RunSearch(sdkName, ctx.Args().Tail()) + return RunSearch(sdkName, cmd.Args().Tail()) } diff --git a/cmd/commands/uninstall.go b/cmd/commands/uninstall.go index 896d3288..308dbf37 100644 --- a/cmd/commands/uninstall.go +++ b/cmd/commands/uninstall.go @@ -17,12 +17,13 @@ package commands import ( +"context" "fmt" "os" "strings" "github.com/pterm/pterm" - "github.com/urfave/cli/v2" + "github.com/urfave/cli/v3" "github.com/version-fox/vfox/internal" "github.com/version-fox/vfox/internal/base" ) @@ -35,8 +36,8 @@ var Uninstall = &cli.Command{ Category: CategorySDK, } -func uninstallCmd(ctx *cli.Context) error { - sdkArg := ctx.Args().First() +func uninstallCmd(ctx context.Context, cmd *cli.Command) error { + sdkArg := cmd.Args().First() if sdkArg == "" { return cli.Exit("sdk name is required", 1) } diff --git a/cmd/commands/unuse.go b/cmd/commands/unuse.go index fc91b9b5..f16db6c0 100644 --- a/cmd/commands/unuse.go +++ b/cmd/commands/unuse.go @@ -17,9 +17,10 @@ package commands import ( + "context" "fmt" - "github.com/urfave/cli/v2" + "github.com/urfave/cli/v3" "github.com/version-fox/vfox/internal" "github.com/version-fox/vfox/internal/base" ) @@ -48,16 +49,16 @@ var Unuse = &cli.Command{ Category: CategorySDK, } -func unuseCmd(ctx *cli.Context) error { - sdkName := ctx.Args().First() +func unuseCmd(ctx context.Context, cmd *cli.Command) error { + sdkName := cmd.Args().First() if len(sdkName) == 0 { return fmt.Errorf("invalid parameter. format: ") } scope := base.Session - if ctx.IsSet("global") { + if cmd.IsSet("global") { scope = base.Global - } else if ctx.IsSet("project") { + } else if cmd.IsSet("project") { scope = base.Project } else { scope = base.Session diff --git a/cmd/commands/update.go b/cmd/commands/update.go index 82ba6755..675a9dd8 100644 --- a/cmd/commands/update.go +++ b/cmd/commands/update.go @@ -17,10 +17,11 @@ package commands import ( +"context" "fmt" "github.com/pterm/pterm" - "github.com/urfave/cli/v2" + "github.com/urfave/cli/v3" "github.com/version-fox/vfox/internal" ) @@ -40,10 +41,10 @@ var Update = &cli.Command{ Category: CategoryPlugin, } -func updateCmd(ctx *cli.Context) error { +func updateCmd(ctx context.Context, cmd *cli.Command) error { manager := internal.NewSdkManager() defer manager.Close() - if ctx.Bool(allFlag) { + if cmd.Bool(allFlag) { if sdks, err := manager.LoadAllSdk(); err == nil { var ( index int @@ -61,7 +62,7 @@ func updateCmd(ctx *cli.Context) error { return cli.Exit(err.Error(), 1) } } else { - args := ctx.Args() + args := cmd.Args() l := args.Len() if l < 1 { return cli.Exit("invalid arguments", 1) diff --git a/cmd/commands/upgrade.go b/cmd/commands/upgrade.go index 7d6361ab..93e0628b 100644 --- a/cmd/commands/upgrade.go +++ b/cmd/commands/upgrade.go @@ -17,6 +17,7 @@ package commands import ( +"context" "fmt" "io" "net/http" @@ -27,7 +28,7 @@ import ( "runtime" "strings" - "github.com/urfave/cli/v2" + "github.com/urfave/cli/v3" "github.com/version-fox/vfox/internal" "github.com/version-fox/vfox/internal/util" ) @@ -110,12 +111,12 @@ func downloadFile(c *http.Client, filepath string, url string) error { return err } -func upgradeCmd(ctx *cli.Context) error { +func upgradeCmd(ctx context.Context, cmd *cli.Command) error { manager := internal.NewSdkManager() defer manager.Close() httpClient := manager.HttpClient() - currVersion := fmt.Sprintf("v%s", ctx.App.Version) + currVersion := fmt.Sprintf("v%s", cmd.Version) latestVersion, err := fetchLatestVersion(httpClient) if err != nil { return cli.Exit("Failed to fetch the latest version: "+err.Error(), 1) diff --git a/cmd/commands/upgrade_win.go b/cmd/commands/upgrade_win.go index 18beed45..7b08f7bb 100644 --- a/cmd/commands/upgrade_win.go +++ b/cmd/commands/upgrade_win.go @@ -19,6 +19,7 @@ package commands import ( +"context" "golang.org/x/sys/windows" "os" "syscall" diff --git a/cmd/commands/use.go b/cmd/commands/use.go index e4290b91..e628010f 100644 --- a/cmd/commands/use.go +++ b/cmd/commands/use.go @@ -17,6 +17,7 @@ package commands import ( + "context" "fmt" "os" "strings" @@ -25,7 +26,7 @@ import ( "github.com/version-fox/vfox/internal" "github.com/version-fox/vfox/internal/base" - "github.com/urfave/cli/v2" + "github.com/urfave/cli/v3" ) var Use = &cli.Command{ @@ -53,8 +54,8 @@ var Use = &cli.Command{ Category: CategorySDK, } -func useCmd(ctx *cli.Context) error { - sdkArg := ctx.Args().First() +func useCmd(ctx context.Context, cmd *cli.Command) error { + sdkArg := cmd.Args().First() if len(sdkArg) == 0 { return fmt.Errorf("invalid parameter. format: [@]") } @@ -72,9 +73,9 @@ func useCmd(ctx *cli.Context) error { } scope := base.Session - if ctx.IsSet("global") { + if cmd.IsSet("global") { scope = base.Global - } else if ctx.IsSet("project") { + } else if cmd.IsSet("project") { scope = base.Project } else { scope = base.Session diff --git a/go.mod b/go.mod index cb9c0c9b..e0d604a8 100644 --- a/go.mod +++ b/go.mod @@ -12,7 +12,7 @@ require ( github.com/schollz/progressbar/v3 v3.14.2 github.com/shirou/gopsutil/v4 v4.25.3 github.com/ulikunitz/xz v0.5.12 - github.com/urfave/cli/v2 v2.27.1 + github.com/urfave/cli/v3 v3.4.1 github.com/yuin/gopher-lua v1.1.1 golang.org/x/crypto v0.35.0 golang.org/x/sys v0.30.0 @@ -26,7 +26,6 @@ require ( github.com/bodgit/plumbing v1.3.0 // indirect github.com/bodgit/windows v1.0.1 // indirect github.com/containerd/console v1.0.4 // indirect - github.com/cpuguy83/go-md2man/v2 v2.0.6 // indirect github.com/ebitengine/purego v0.8.3 // indirect github.com/go-ole/go-ole v1.2.6 // indirect github.com/gookit/color v1.5.4 // indirect @@ -40,11 +39,9 @@ require ( github.com/pierrec/lz4/v4 v4.1.21 // indirect github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c // indirect github.com/rivo/uniseg v0.4.7 // indirect - github.com/russross/blackfriday/v2 v2.1.0 // indirect github.com/tklauser/go-sysconf v0.3.12 // indirect github.com/tklauser/numcpus v0.6.1 // indirect github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e // indirect - github.com/xrash/smetrics v0.0.0-20240312152122-5f08fbb34913 // indirect github.com/yusufpapurcu/wmi v1.2.4 // indirect go4.org v0.0.0-20200411211856-f5505b9728dd // indirect golang.org/x/net v0.29.0 // indirect diff --git a/go.sum b/go.sum index 562d7526..fb710ea8 100644 --- a/go.sum +++ b/go.sum @@ -55,8 +55,6 @@ github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDk github.com/containerd/console v1.0.3/go.mod h1:7LqA/THxQ86k76b8c/EMSiaJ3h1eZkMkXar0TQ1gf3U= github.com/containerd/console v1.0.4 h1:F2g4+oChYvBTsASRTz8NP6iIAi97J3TtSAsLbIFn4ro= github.com/containerd/console v1.0.4/go.mod h1:YynlIjWYF8myEu6sdkwKIvGQq+cOckRm6So2avqoYAk= -github.com/cpuguy83/go-md2man/v2 v2.0.6 h1:XJtiaUW6dEEqVuZiMTn1ldk455QWwEIsMIJlo5vtkx0= -github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -155,8 +153,6 @@ github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJ github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ= github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= -github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk= -github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/rwcarlsen/goexif v0.0.0-20190401172101-9e8deecbddbd/go.mod h1:hPqNNc0+uJM6H+SuU8sEs5K5IQeKccPqeSjfgcKGgPk= github.com/schollz/progressbar/v3 v3.14.2 h1:EducH6uNLIWsr560zSV1KrTeUb/wZGAHqyMFIEa99ks= github.com/schollz/progressbar/v3 v3.14.2/go.mod h1:aQAZQnhF4JGFtRJiw/eobaXpsqpVQAftEQ+hLGXaRc4= @@ -182,13 +178,11 @@ github.com/tklauser/numcpus v0.6.1 h1:ng9scYS7az0Bk4OZLvrNXNSAO2Pxr1XXRAPyjhIx+F github.com/tklauser/numcpus v0.6.1/go.mod h1:1XfjsgE2zo8GVw7POkMbHENHzVg3GzmoZ9fESEdAacY= github.com/ulikunitz/xz v0.5.12 h1:37Nm15o69RwBkXM0J6A5OlE67RZTfzUxTj8fB3dfcsc= github.com/ulikunitz/xz v0.5.12/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14= -github.com/urfave/cli/v2 v2.27.1 h1:8xSQ6szndafKVRmfyeUMxkNUJQMjL1F2zmsZ+qHpfho= -github.com/urfave/cli/v2 v2.27.1/go.mod h1:8qnjx1vcq5s2/wpsqoZFndg2CE5tNFyrTvS6SinrnYQ= +github.com/urfave/cli/v3 v3.4.1 h1:1M9UOCy5bLmGnuu1yn3t3CB4rG79Rtoxuv1sPhnm6qM= +github.com/urfave/cli/v3 v3.4.1/go.mod h1:FJSKtM/9AiiTOJL4fJ6TbMUkxBXn7GO9guZqoZtpYpo= github.com/xo/terminfo v0.0.0-20210125001918-ca9a967f8778/go.mod h1:2MuV+tbUrU1zIOPMxZ5EncGwgmMJsa+9ucAQZXxsObs= github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e h1:JVG44RsyaB9T2KIHavMF/ppJZNG9ZpyihvCd0w101no= github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e/go.mod h1:RbqR21r5mrJuqunuUZ/Dhy/avygyECGrLceyNeo4LiM= -github.com/xrash/smetrics v0.0.0-20240312152122-5f08fbb34913 h1:+qGGcbkzsfDQNPPe9UDgpxAWQrhbbBXOYJFQDq/dtJw= -github.com/xrash/smetrics v0.0.0-20240312152122-5f08fbb34913/go.mod h1:4aEEwZQutDLsQv2Deui4iYQ6DWTxR14g6m8Wv88+Xqk= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= github.com/yuin/gopher-lua v1.1.1 h1:kYKnWBjvbNP4XLT3+bPEwAXJx262OhaHDWDVOPjL46M= github.com/yuin/gopher-lua v1.1.1/go.mod h1:GBR0iDaNXjAgGg9zfCvksxSRnQx76gclCIb7kdAd1Pw= diff --git a/internal/manager.go b/internal/manager.go index 2bbdfc04..872fa625 100644 --- a/internal/manager.go +++ b/internal/manager.go @@ -33,7 +33,7 @@ import ( "github.com/pterm/pterm" "github.com/shirou/gopsutil/v4/process" - "github.com/urfave/cli/v2" + "github.com/urfave/cli/v3" "github.com/version-fox/vfox/internal/base" "github.com/version-fox/vfox/internal/cache" "github.com/version-fox/vfox/internal/config" From dfcdeff086f67cba6d71de03ddc54c7112ed3680 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 30 Sep 2025 06:12:30 +0000 Subject: [PATCH 03/23] Add tests for use command to verify flag placement flexibility Co-authored-by: aooohan <40265686+aooohan@users.noreply.github.com> --- cmd/commands/use_test.go | 155 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 155 insertions(+) create mode 100644 cmd/commands/use_test.go diff --git a/cmd/commands/use_test.go b/cmd/commands/use_test.go new file mode 100644 index 00000000..5e4558fa --- /dev/null +++ b/cmd/commands/use_test.go @@ -0,0 +1,155 @@ +/* + * Copyright 2025 Han Li and contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package commands + +import ( + "testing" + + "github.com/version-fox/vfox/internal/base" +) + +func TestUseScopeSelection(t *testing.T) { + // Test that scope selection logic works correctly + tests := []struct { + name string + globalSet bool + projectSet bool + sessionSet bool + expectedScope base.UseScope + }{ + { + name: "Default to session scope", + globalSet: false, + projectSet: false, + sessionSet: false, + expectedScope: base.Session, + }, + { + name: "Global scope when global flag set", + globalSet: true, + projectSet: false, + sessionSet: false, + expectedScope: base.Global, + }, + { + name: "Project scope when project flag set", + globalSet: false, + projectSet: true, + sessionSet: false, + expectedScope: base.Project, + }, + { + name: "Session scope when session flag set", + globalSet: false, + projectSet: false, + sessionSet: true, + expectedScope: base.Session, + }, + { + name: "Global takes precedence over project", + globalSet: true, + projectSet: true, + sessionSet: false, + expectedScope: base.Global, + }, + { + name: "Global takes precedence over session", + globalSet: true, + projectSet: false, + sessionSet: true, + expectedScope: base.Global, + }, + { + name: "Project takes precedence over session", + globalSet: false, + projectSet: true, + sessionSet: true, + expectedScope: base.Project, + }, + { + name: "Global takes precedence over all", + globalSet: true, + projectSet: true, + sessionSet: true, + expectedScope: base.Global, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + // Simulate the scope selection logic from the use command + scope := base.Session + if tt.globalSet { + scope = base.Global + } else if tt.projectSet { + scope = base.Project + } else { + scope = base.Session + } + + if scope != tt.expectedScope { + t.Errorf("Expected scope %v, but got %v", tt.expectedScope, scope) + } + }) + } +} + +func TestUseCommandValidation(t *testing.T) { + // Test input validation logic + tests := []struct { + name string + sdkArg string + expectError bool + errorMsg string + }{ + { + name: "Valid SDK name", + sdkArg: "nodejs", + expectError: false, + errorMsg: "", + }, + { + name: "Empty SDK name", + sdkArg: "", + expectError: true, + errorMsg: "invalid parameter. format: [@]", + }, + { + name: "SDK name with version", + sdkArg: "nodejs@18.0.0", + expectError: false, + errorMsg: "", + }, + { + name: "SDK name with special characters", + sdkArg: "node-js@1.0", + expectError: false, + errorMsg: "", + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + // Simulate the validation logic from the use command + hasError := len(tt.sdkArg) == 0 + + if hasError != tt.expectError { + t.Errorf("Expected error: %v, but got error: %v", tt.expectError, hasError) + } + }) + } +} From 40365de1ac1e62dc3c7ba799cc83a582dad02e1a Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 30 Sep 2025 06:14:56 +0000 Subject: [PATCH 04/23] Update documentation to reflect flexible flag placement in use/unuse commands Co-authored-by: aooohan <40265686+aooohan@users.noreply.github.com> --- docs/usage/core-commands.md | 6 ++++++ docs/zh-hans/usage/core-commands.md | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/docs/usage/core-commands.md b/docs/usage/core-commands.md index 5aa1697b..851faa5d 100644 --- a/docs/usage/core-commands.md +++ b/docs/usage/core-commands.md @@ -82,6 +82,9 @@ Set the runtime version. vfox use [options] [@] vfox u [options] [@] + +# Options can also be placed after arguments +vfox use [@] [options] ``` `sdk-name`: SDK name @@ -109,6 +112,9 @@ Unset the runtime version from a specific scope. ```shell vfox unuse [options] + +# Options can also be placed after arguments +vfox unuse [options] ``` `sdk-name`: SDK name diff --git a/docs/zh-hans/usage/core-commands.md b/docs/zh-hans/usage/core-commands.md index 63c90141..61eb4e9b 100644 --- a/docs/zh-hans/usage/core-commands.md +++ b/docs/zh-hans/usage/core-commands.md @@ -84,6 +84,9 @@ vfox install --yes --all vfox use [options] [@] vfox u [options] [@] + +# 选项也可以放在参数之后 +vfox use [@] [options] ``` `sdk-name`: SDK 名称 @@ -111,6 +114,9 @@ vfox u [options] [@] ```shell vfox unuse [options] + +# 选项也可以放在参数之后 +vfox unuse [options] ``` `sdk-name`: SDK 名称 From 3421e7b065f9925a5e6332a1a16f2c5973e61367 Mon Sep 17 00:00:00 2001 From: Han Li Date: Tue, 30 Sep 2025 14:24:31 +0800 Subject: [PATCH 05/23] Update core-commands.md --- docs/usage/core-commands.md | 6 ------ 1 file changed, 6 deletions(-) diff --git a/docs/usage/core-commands.md b/docs/usage/core-commands.md index 851faa5d..5aa1697b 100644 --- a/docs/usage/core-commands.md +++ b/docs/usage/core-commands.md @@ -82,9 +82,6 @@ Set the runtime version. vfox use [options] [@] vfox u [options] [@] - -# Options can also be placed after arguments -vfox use [@] [options] ``` `sdk-name`: SDK name @@ -112,9 +109,6 @@ Unset the runtime version from a specific scope. ```shell vfox unuse [options] - -# Options can also be placed after arguments -vfox unuse [options] ``` `sdk-name`: SDK name From 3246024608cc27168056e67d8f68204eac6b5893 Mon Sep 17 00:00:00 2001 From: Han Li Date: Tue, 30 Sep 2025 14:25:12 +0800 Subject: [PATCH 06/23] Update core-commands.md --- docs/zh-hans/usage/core-commands.md | 6 ------ 1 file changed, 6 deletions(-) diff --git a/docs/zh-hans/usage/core-commands.md b/docs/zh-hans/usage/core-commands.md index 61eb4e9b..63c90141 100644 --- a/docs/zh-hans/usage/core-commands.md +++ b/docs/zh-hans/usage/core-commands.md @@ -84,9 +84,6 @@ vfox install --yes --all vfox use [options] [@] vfox u [options] [@] - -# 选项也可以放在参数之后 -vfox use [@] [options] ``` `sdk-name`: SDK 名称 @@ -114,9 +111,6 @@ vfox use [@] [options] ```shell vfox unuse [options] - -# 选项也可以放在参数之后 -vfox unuse [options] ``` `sdk-name`: SDK 名称 From 4ce7631eb47fb9dde224ea00ebc2dd5e7b0bd15f Mon Sep 17 00:00:00 2001 From: Han Li Date: Tue, 30 Sep 2025 14:26:42 +0800 Subject: [PATCH 07/23] Delete cmd/commands/use_test.go --- cmd/commands/use_test.go | 155 --------------------------------------- 1 file changed, 155 deletions(-) delete mode 100644 cmd/commands/use_test.go diff --git a/cmd/commands/use_test.go b/cmd/commands/use_test.go deleted file mode 100644 index 5e4558fa..00000000 --- a/cmd/commands/use_test.go +++ /dev/null @@ -1,155 +0,0 @@ -/* - * Copyright 2025 Han Li and contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package commands - -import ( - "testing" - - "github.com/version-fox/vfox/internal/base" -) - -func TestUseScopeSelection(t *testing.T) { - // Test that scope selection logic works correctly - tests := []struct { - name string - globalSet bool - projectSet bool - sessionSet bool - expectedScope base.UseScope - }{ - { - name: "Default to session scope", - globalSet: false, - projectSet: false, - sessionSet: false, - expectedScope: base.Session, - }, - { - name: "Global scope when global flag set", - globalSet: true, - projectSet: false, - sessionSet: false, - expectedScope: base.Global, - }, - { - name: "Project scope when project flag set", - globalSet: false, - projectSet: true, - sessionSet: false, - expectedScope: base.Project, - }, - { - name: "Session scope when session flag set", - globalSet: false, - projectSet: false, - sessionSet: true, - expectedScope: base.Session, - }, - { - name: "Global takes precedence over project", - globalSet: true, - projectSet: true, - sessionSet: false, - expectedScope: base.Global, - }, - { - name: "Global takes precedence over session", - globalSet: true, - projectSet: false, - sessionSet: true, - expectedScope: base.Global, - }, - { - name: "Project takes precedence over session", - globalSet: false, - projectSet: true, - sessionSet: true, - expectedScope: base.Project, - }, - { - name: "Global takes precedence over all", - globalSet: true, - projectSet: true, - sessionSet: true, - expectedScope: base.Global, - }, - } - - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - // Simulate the scope selection logic from the use command - scope := base.Session - if tt.globalSet { - scope = base.Global - } else if tt.projectSet { - scope = base.Project - } else { - scope = base.Session - } - - if scope != tt.expectedScope { - t.Errorf("Expected scope %v, but got %v", tt.expectedScope, scope) - } - }) - } -} - -func TestUseCommandValidation(t *testing.T) { - // Test input validation logic - tests := []struct { - name string - sdkArg string - expectError bool - errorMsg string - }{ - { - name: "Valid SDK name", - sdkArg: "nodejs", - expectError: false, - errorMsg: "", - }, - { - name: "Empty SDK name", - sdkArg: "", - expectError: true, - errorMsg: "invalid parameter. format: [@]", - }, - { - name: "SDK name with version", - sdkArg: "nodejs@18.0.0", - expectError: false, - errorMsg: "", - }, - { - name: "SDK name with special characters", - sdkArg: "node-js@1.0", - expectError: false, - errorMsg: "", - }, - } - - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - // Simulate the validation logic from the use command - hasError := len(tt.sdkArg) == 0 - - if hasError != tt.expectError { - t.Errorf("Expected error: %v, but got error: %v", tt.expectError, hasError) - } - }) - } -} From c33d5215e82378cf5d8334bbfa4a7f1bc70800fd Mon Sep 17 00:00:00 2001 From: Han Li Date: Tue, 30 Sep 2025 14:27:05 +0800 Subject: [PATCH 08/23] Update cmd/commands/activate.go Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- cmd/commands/activate.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/commands/activate.go b/cmd/commands/activate.go index 57cea136..f3886ddf 100644 --- a/cmd/commands/activate.go +++ b/cmd/commands/activate.go @@ -17,7 +17,7 @@ package commands import ( -"context" + "context" "fmt" "os" "strings" From a089acae1e8960f611437c2a2dc25ebde8d1513e Mon Sep 17 00:00:00 2001 From: Han Li Date: Tue, 30 Sep 2025 14:27:16 +0800 Subject: [PATCH 09/23] Update cmd/commands/available.go Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- cmd/commands/available.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/commands/available.go b/cmd/commands/available.go index cee19a7e..14e199aa 100644 --- a/cmd/commands/available.go +++ b/cmd/commands/available.go @@ -17,7 +17,7 @@ package commands import ( -"context" + "context" "strings" "github.com/pterm/pterm" From 9488982d11aca88168ea3b7f90062af695a77aa8 Mon Sep 17 00:00:00 2001 From: Han Li Date: Tue, 30 Sep 2025 14:27:26 +0800 Subject: [PATCH 10/23] Update cmd/commands/cd.go Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- cmd/commands/cd.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/commands/cd.go b/cmd/commands/cd.go index f9efc0ca..4b54e2e2 100644 --- a/cmd/commands/cd.go +++ b/cmd/commands/cd.go @@ -1,7 +1,7 @@ package commands import ( -"context" + "context" "fmt" "os" From ef0f1d0a15c3f10d577fa9102796b3fb739b1569 Mon Sep 17 00:00:00 2001 From: Han Li Date: Tue, 30 Sep 2025 14:27:36 +0800 Subject: [PATCH 11/23] Update cmd/commands/config.go Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- cmd/commands/config.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/commands/config.go b/cmd/commands/config.go index 04787262..68fbafb5 100644 --- a/cmd/commands/config.go +++ b/cmd/commands/config.go @@ -1,7 +1,7 @@ package commands import ( -"context" + "context" "errors" "fmt" "github.com/version-fox/vfox/internal/config" From fb65002b6a0afa5d9a2add49b0cb16b9d14d8d34 Mon Sep 17 00:00:00 2001 From: Han Li Date: Tue, 30 Sep 2025 14:27:45 +0800 Subject: [PATCH 12/23] Update cmd/commands/current.go Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- cmd/commands/current.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/commands/current.go b/cmd/commands/current.go index 68180403..4cd719c0 100644 --- a/cmd/commands/current.go +++ b/cmd/commands/current.go @@ -17,7 +17,7 @@ package commands import ( -"context" + "context" "fmt" "github.com/pterm/pterm" From bab928fd301601c5239ee62c1508ea1c5dc8bddf Mon Sep 17 00:00:00 2001 From: Han Li Date: Tue, 30 Sep 2025 14:27:54 +0800 Subject: [PATCH 13/23] Update cmd/commands/env.go Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- cmd/commands/env.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/commands/env.go b/cmd/commands/env.go index de430e5b..d89a5f54 100644 --- a/cmd/commands/env.go +++ b/cmd/commands/env.go @@ -17,7 +17,7 @@ package commands import ( -"context" + "context" "encoding/json" "fmt" From 73bd25e7f94df12193b7f95891354d7ab2197c15 Mon Sep 17 00:00:00 2001 From: Han Li Date: Tue, 30 Sep 2025 14:28:03 +0800 Subject: [PATCH 14/23] Update cmd/commands/info.go Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- cmd/commands/info.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/commands/info.go b/cmd/commands/info.go index 14399bcd..cef9e25f 100644 --- a/cmd/commands/info.go +++ b/cmd/commands/info.go @@ -17,7 +17,7 @@ package commands import ( -"context" + "context" "fmt" "path/filepath" "strings" From 4d056f321a3b313344409e9c02f2a97be6bb7d50 Mon Sep 17 00:00:00 2001 From: Han Li Date: Tue, 30 Sep 2025 14:28:18 +0800 Subject: [PATCH 15/23] Update cmd/commands/upgrade_win.go Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- cmd/commands/upgrade_win.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/commands/upgrade_win.go b/cmd/commands/upgrade_win.go index 7b08f7bb..fe7fabeb 100644 --- a/cmd/commands/upgrade_win.go +++ b/cmd/commands/upgrade_win.go @@ -19,7 +19,7 @@ package commands import ( -"context" + "context" "golang.org/x/sys/windows" "os" "syscall" From e0ae6d8fd0486bebd4d12539a0c13deea96446f3 Mon Sep 17 00:00:00 2001 From: Han Li Date: Tue, 30 Sep 2025 14:28:45 +0800 Subject: [PATCH 16/23] Update cmd/commands/upgrade.go Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- cmd/commands/upgrade.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/commands/upgrade.go b/cmd/commands/upgrade.go index 93e0628b..eb2aab8a 100644 --- a/cmd/commands/upgrade.go +++ b/cmd/commands/upgrade.go @@ -17,7 +17,7 @@ package commands import ( -"context" + "context" "fmt" "io" "net/http" From 79ef89c503fc0efb9a55a4b4044b7db236cf1052 Mon Sep 17 00:00:00 2001 From: Han Li Date: Tue, 30 Sep 2025 14:28:54 +0800 Subject: [PATCH 17/23] Update cmd/commands/update.go Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- cmd/commands/update.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/commands/update.go b/cmd/commands/update.go index 675a9dd8..fb77d540 100644 --- a/cmd/commands/update.go +++ b/cmd/commands/update.go @@ -17,7 +17,7 @@ package commands import ( -"context" + "context" "fmt" "github.com/pterm/pterm" From 296d8f4c8d46c434f0fcdc01c022d30391c815d6 Mon Sep 17 00:00:00 2001 From: Han Li Date: Tue, 30 Sep 2025 14:29:02 +0800 Subject: [PATCH 18/23] Update cmd/commands/uninstall.go Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- cmd/commands/uninstall.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/commands/uninstall.go b/cmd/commands/uninstall.go index 308dbf37..501d026e 100644 --- a/cmd/commands/uninstall.go +++ b/cmd/commands/uninstall.go @@ -17,7 +17,7 @@ package commands import ( -"context" + "context" "fmt" "os" "strings" From 299145109363211f1ba4d46daedd54109c762d0a Mon Sep 17 00:00:00 2001 From: Han Li Date: Tue, 30 Sep 2025 14:29:13 +0800 Subject: [PATCH 19/23] Update cmd/commands/remove.go Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- cmd/commands/remove.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/commands/remove.go b/cmd/commands/remove.go index 2537f958..ebb96ae2 100644 --- a/cmd/commands/remove.go +++ b/cmd/commands/remove.go @@ -17,7 +17,7 @@ package commands import ( -"context" + "context" "github.com/pterm/pterm" "github.com/urfave/cli/v3" "github.com/version-fox/vfox/internal" From b40f87f32f035a90ef066c25c55cdfae62a38c0f Mon Sep 17 00:00:00 2001 From: Han Li Date: Tue, 30 Sep 2025 14:29:24 +0800 Subject: [PATCH 20/23] Update cmd/commands/search.go Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- cmd/commands/search.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/commands/search.go b/cmd/commands/search.go index bb75190b..c8d90093 100644 --- a/cmd/commands/search.go +++ b/cmd/commands/search.go @@ -17,7 +17,7 @@ package commands import ( -"context" + "context" "fmt" "math" "os" From d3a6b21fb63981ce4c89f9110a642b8476be5cd2 Mon Sep 17 00:00:00 2001 From: Han Li Date: Tue, 30 Sep 2025 14:29:35 +0800 Subject: [PATCH 21/23] Update cmd/commands/list.go Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- cmd/commands/list.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/commands/list.go b/cmd/commands/list.go index 05300b13..80e6ccf6 100644 --- a/cmd/commands/list.go +++ b/cmd/commands/list.go @@ -17,7 +17,7 @@ package commands import ( -"context" + "context" "fmt" "github.com/pterm/pterm" From b246bb408311264119f4f7e3711323cc7e106205 Mon Sep 17 00:00:00 2001 From: Han Li Date: Tue, 30 Sep 2025 14:29:45 +0800 Subject: [PATCH 22/23] Update cmd/commands/install.go Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- cmd/commands/install.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/commands/install.go b/cmd/commands/install.go index 518f38e7..89504d02 100644 --- a/cmd/commands/install.go +++ b/cmd/commands/install.go @@ -17,7 +17,7 @@ package commands import ( -"context" + "context" "errors" "fmt" "os" From 60e889ed10b0c96dbc8d8f20b68b0706f1886732 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 30 Sep 2025 06:35:03 +0000 Subject: [PATCH 23/23] Fix unused context import in upgrade_win.go Co-authored-by: aooohan <40265686+aooohan@users.noreply.github.com> --- cmd/commands/upgrade_win.go | 1 - 1 file changed, 1 deletion(-) diff --git a/cmd/commands/upgrade_win.go b/cmd/commands/upgrade_win.go index fe7fabeb..18beed45 100644 --- a/cmd/commands/upgrade_win.go +++ b/cmd/commands/upgrade_win.go @@ -19,7 +19,6 @@ package commands import ( - "context" "golang.org/x/sys/windows" "os" "syscall"