Files
go-admin/cmd/cobra.go
zhangwenjian 8ffde94433 chore🔧: move to go-admin-core v2
Every import of the module changes, not only the seven packages that
moved out of sdk/pkg: Go requires the major version in the path from v2
on. Both happen in one pass —

    go run github.com/go-admin-team/go-admin-core/tools/coreupgrade@v2.0.0 -w -v2 .
    go mod tidy

— which is the command the release notes give, run here as a consumer
would run it. 210 imports across 95 files.

The compatibility shims this used are gone in v2, so the paths that
moved had to move: sdk/pkg/captcha, sdk/pkg/jwtauth and its user
package, sdk/pkg/response and sdk/pkg/casbin.

The count of unformatted files is unchanged at 34, none of them touched
by this: the tool reformats a file only if it was already gofmt clean,
so a migration cannot disappear into whitespace.
2026-08-23 13:26:46 +08:00

58 lines
1.3 KiB
Go
Raw Permalink Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
package cmd
import (
"errors"
"fmt"
"github.com/go-admin-team/go-admin-core/v2/sdk/pkg"
"go-admin/cmd/app"
"go-admin/common/global"
"os"
"github.com/spf13/cobra"
"go-admin/cmd/api"
"go-admin/cmd/config"
"go-admin/cmd/migrate"
"go-admin/cmd/version"
)
var rootCmd = &cobra.Command{
Use: "go-admin",
Short: "go-admin",
SilenceUsage: true,
Long: `go-admin`,
Args: func(cmd *cobra.Command, args []string) error {
if len(args) < 1 {
tip()
return errors.New(pkg.Red("requires at least one arg"))
}
return nil
},
PersistentPreRunE: func(*cobra.Command, []string) error { return nil },
Run: func(cmd *cobra.Command, args []string) {
tip()
},
}
func tip() {
usageStr := `欢迎使用 ` + pkg.Green(`go-admin `+global.Version) + ` 可以使用 ` + pkg.Red(`-h`) + ` 查看命令`
usageStr1 := `也可以参考 https://doc.go-admin.dev/guide/ksks 的相关内容`
fmt.Printf("%s\n", usageStr)
fmt.Printf("%s\n", usageStr1)
}
func init() {
rootCmd.AddCommand(api.StartCmd)
rootCmd.AddCommand(migrate.StartCmd)
rootCmd.AddCommand(version.StartCmd)
rootCmd.AddCommand(config.StartCmd)
rootCmd.AddCommand(app.StartCmd)
}
//Execute : apply commands
func Execute() {
if err := rootCmd.Execute(); err != nil {
os.Exit(-1)
}
}