commit 9f0d57e
chld
·
2026-02-07 02:38:43 +0000 UTC
parent a7c27ac
try man
3 files changed,
+10,
-6
M
main.go
+6,
-1
1@@ -99,7 +99,12 @@ func main() {
2 }
3 dgre.VC("DTR_DIR")
4 for i := range len(pkgs) {
5- fmt.Println(dgr.FindPkg(pkgs[i]))
6+ pkg := dgr.FindPkg(pkgs[i])
7+ if pkg == "" {
8+ dgr.Die("could not find package", pkgs[i], 0)
9+ } else {
10+ fmt.Println(pkg)
11+ }
12 }
13 case "h", "help":
14 help()
+1,
-1
1@@ -13,7 +13,7 @@ func Build(pkg string, do string) {
2 dgr.Msg(do+"ing", pkg)
3
4 in, out := os.Stdin, os.Stdout
5- cmd := exec.Command("sh", dgr.FindPkg(pkg)+string(filepath.Separator)+makefile, do)
6+ cmd := exec.Command("sh", filepath.Join(dgr.FindPkg(pkg), makefile), do)
7 cmd.Stdin, cmd.Stdout = in, out // asign stdin andS stout to cmd
8 cmd.Stderr = os.Stderr // and stderr, i guess
9
+3,
-4
1@@ -7,14 +7,13 @@ import (
2 "os"
3 "os/exec"
4 "path/filepath"
5- "strings"
6 )
7
8 func Inst(pkg string) {
9
10 in, out := os.Stdin, os.Stdout
11- pkginst := filepath.Join("/var/tmp/dtr", "pkg-"+pkg+"-git", "*") // hard code git for now
12- pk, err := filepath.Glob(pkginst)
13+ pkginst := filepath.Join("/var/tmp/dtr", "pkg-"+pkg+"-git") // hard code git for now
14+ pk, err := filepath.Glob(pkginst + "/*")
15
16 if err != nil || len(pk) == 0 {
17 dgr.Die("no files to install in", pkginst, 1)
18@@ -33,7 +32,7 @@ func Inst(pkg string) {
19 } else {
20 dgr.Msg("installing", pkg)
21
22- filepath.WalkDir(strings.ReplaceAll(pkginst, "*", ""), func(path string, d fs.DirEntry, err error) error {
23+ filepath.WalkDir(pkginst, func(path string, d fs.DirEntry, err error) error {
24 if err != nil {
25 fmt.Println(err)
26 }