Skip to content

Commit 5aa8708

Browse files
committed
read all .conf in current working directory
1 parent 92fb077 commit 5aa8708

File tree

2 files changed

+18
-10
lines changed

2 files changed

+18
-10
lines changed

amk.conf

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,4 @@ SHIM=500
33
SCALE=1
44

55
S=2
6-
C=left
7-
I= begin
8-
9-
L=3
10-
C=left
11-
I=wow
12-
T=enter*3
13-
L
14-
15-
I= done
6+
C=right

main.go

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,22 @@ import (
1414
)
1515

1616
func main() {
17+
file, err := os.Open(".")
18+
if err != nil {
19+
log.Fatalln("fail opening directory")
20+
}
21+
list, err := file.Readdirnames(0)
22+
if err != nil {
23+
log.Fatalln("fail read directory")
24+
}
25+
for _, name := range list {
26+
if strings.HasSuffix(name, ".conf") {
27+
readFileAndRun(name)
28+
}
29+
}
30+
}
31+
32+
func readFileAndRun(fileName string) {
1733
file, err := os.Open("amk.conf")
1834
if err != nil {
1935
log.Fatal(err)
@@ -41,6 +57,7 @@ func main() {
4157
return
4258
}
4359
_ = command.RunCommand(commands, common)
60+
4461
}
4562

4663
var commonItems = []model.CommonItem{

0 commit comments

Comments
 (0)