feat: migrate to golang

This commit is contained in:
2026-07-19 20:01:38 +08:00
parent 302d4e6bb5
commit a2630df9e0
69 changed files with 4750 additions and 3369 deletions

33
internal/cli/core.go Normal file
View File

@ -0,0 +1,33 @@
package cli
import "github.com/spf13/cobra"
func newCoreCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "core",
Short: "Manage scientific-surfing core components",
}
cmd.AddCommand(newCoreUpdateCmd())
return cmd
}
func newCoreUpdateCmd() *cobra.Command {
var version string
var force bool
c := &cobra.Command{
Use: "update",
Short: "Update scientific-surfing core components",
Args: cobra.NoArgs,
RunE: func(cmd *cobra.Command, args []string) error {
m, err := newManagers("", "", "")
if err != nil {
return err
}
m.Core.Update(version, force)
return nil
},
}
c.Flags().StringVar(&version, "version", "", "Specific version to download (e.g., v1.18.5). If not specified, downloads latest")
c.Flags().BoolVar(&force, "force", false, "Force update even if binary already exists")
return c
}