26 lines
373 B
Go
26 lines
373 B
Go
package initialize
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
"os/exec"
|
|
)
|
|
|
|
func CheckHomebrew(ctx context.Context) error {
|
|
dir, err := exec.LookPath("brew")
|
|
if len(dir) > 0 {
|
|
fmt.Println("Homebrew 路径为: " + dir)
|
|
return nil
|
|
}
|
|
|
|
install := ReadInstallHomebrew(ctx)
|
|
if install {
|
|
err = InstallHomebrew(ctx)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
}
|
|
|
|
return CheckHomebrew(ctx)
|
|
}
|