INNER CODE UNIT · Go
newInstallCommand
gameknife/gkNextEngine · tools/gnb/cmd/gnb/main.go:1171
func newInstallCommand(ctx appContext) *cobra.Command {
return &cobra.Command{
Use: "install",
Short: "Install gnb to a user bin directory",
RunE: func(cmd *cobra.Command, args []string) error {
exe, err := os.Executable()
if err != nil {
return err
}
home, err := os.UserHomeDir()
if err != nil {
return err
}
dir := filepath.Join(home, ".local", "bin")
name := "gnb"
if runtime.GOOS == "windows" {
dir = filepath.Join(home, "bin")
name = "gnb.exe"