commit 0e9751d
chld
·
2026-02-06 04:27:51 +0000 UTC
parent 36c4d73
yuh
4 files changed,
+22,
-5
+3,
-0
1@@ -3,3 +3,6 @@ dtr
2 dtr.sh
3 dtrgolang/
4 dtrgolang
5+dgr
6+dgr.sh
7+dgr/
+4,
-4
1@@ -15,13 +15,13 @@ func Info(a string) {
2 fmt.Printf("%s\n", a)
3 }
4
5-func Die(a string, exit int) {
6+func Die(a string, b string, exit int) {
7 fmt.Printf("\033[m\033[31;1mERROR:\033[m ")
8- fmt.Printf("%s\n", a)
9+ fmt.Printf("%s: %s\n", a, b)
10 os.Exit(exit)
11 }
12
13-func Warn(a string) {
14+func Warn(a string, b string) {
15 fmt.Printf("\033[m\033[33;1mwarning:\033[m ")
16- fmt.Printf("%s\n", a)
17+ fmt.Printf("%s: %s\n", a, b)
18 }
+12,
-0
1@@ -0,0 +1,12 @@
2+package dgre
3+
4+import (
5+ "git.sr.ht/~chld/dgr/cmd"
6+ "os"
7+)
8+
9+func VC(a string) {
10+ if os.Getenv(a) == "" {
11+ dgr.Die("variable not found", a, 1)
12+ }
13+}
M
main.go
+3,
-1
1@@ -3,6 +3,7 @@ package main
2 import (
3 "fmt"
4 "git.sr.ht/~chld/dgr/cmd"
5+ "git.sr.ht/~chld/dgr/extra"
6 "os"
7 "path/filepath"
8 )
9@@ -22,8 +23,9 @@ func main() {
10
11 switch os.Args[1] {
12 case "sp":
13+ dgre.VC("DTR_DIR")
14 fmt.Println(dgr.FindPkg(os.Args[2]))
15 default:
16- dgr.Die("sorry, not implemented yet", 1)
17+ dgr.Die("sorry, not implemented yet", os.Args[1], 1)
18 }
19 }