bb/src/tool/useprog/main.go

26 lines
328 B
Go
Raw Normal View History

2022-11-21 01:27:21 +03:00
package useprog
import (
"os/exec"
"fmt"
2023-03-24 19:47:31 +03:00
"github.com/surdeus/gomtool/src/mtool"
2022-11-21 01:27:21 +03:00
)
2023-03-24 19:47:31 +03:00
func Run(flagSet *mtool.Flags) {
flagSet.Parse()
args := flagSet.Args()
2022-11-21 01:27:21 +03:00
2023-03-24 19:47:31 +03:00
if len(args) < 1 {
2022-11-21 01:27:21 +03:00
flagSet.Usage()
}
for _, v := range args {
_, err := exec.LookPath(v)
if err != nil {
continue
}
fmt.Printf("%s", v)
break
}
}