Skip to content
This repository was archived by the owner on Mar 10, 2022. It is now read-only.

Commit b227370

Browse files
committed
Allow --file argument to run a specific file
1 parent bda8d94 commit b227370

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

elara.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,19 @@ func main() {
1414
args := os.Args
1515
//This isn't really a repl, but it will be. for now, it's close enough in that it will print the output of every expression
1616
var repl = false
17-
for _, arg := range args {
17+
var fileName = "elara.el"
18+
for i, arg := range args {
1819
if arg == "--repl" {
1920
repl = true
20-
break
21+
}
22+
if arg == "--file" {
23+
fileName = args[i + 1]
2124
}
2225
}
2326

2427
loadStdLib()
2528

26-
fileName, input := loadFile("elara.el")
29+
_, input := loadFile(fileName)
2730
start := time.Now()
2831
_, lexTime, parseTime, execTime := base.Execute(&fileName, string(input), repl)
2932

0 commit comments

Comments
 (0)