xtool/cppkg:tips when app managers not found

This commit is contained in:
luoliwoshang
2025-05-09 12:10:37 +08:00
parent f794592f42
commit f09a423ee7

View File

@@ -17,6 +17,7 @@
package cppkg
import (
"fmt"
"os"
"os/exec"
"strings"
@@ -77,12 +78,14 @@ func (p *Tool) Get(quietInstall bool) (app string, err error) {
}
func (p *Tool) getAppManager() (amPath string, install []string, err error) {
var notFoundMgs []string
for _, install = range p.installs {
am := install[0]
if amPath, err = exec.LookPath(am); err == nil {
return
}
notFoundMgs = append(notFoundMgs, am)
}
err = ErrNotFound
err = fmt.Errorf("app managers not found: %s: %w", strings.Join(notFoundMgs, ", "), ErrNotFound)
return
}