use commandr
This commit is contained in:
parent
658f8f96c1
commit
074fde11ea
3 changed files with 9 additions and 6 deletions
13
src/main.d
13
src/main.d
|
|
@ -3,6 +3,8 @@ import std.file;
|
|||
import std.conv;
|
||||
import std.exception;
|
||||
|
||||
import commandr;
|
||||
|
||||
import token;
|
||||
import tokentype;
|
||||
import scanner;
|
||||
|
|
@ -44,12 +46,11 @@ void runPrompt(){
|
|||
}
|
||||
|
||||
int main(string[] argv){
|
||||
if(argv.length > 2){
|
||||
writeln("Usage: jlox [script]");
|
||||
return 1;
|
||||
}
|
||||
if(argv.length == 2)
|
||||
runFile(argv[1]);
|
||||
auto args = new Program("lox")
|
||||
.add(new Argument("path").optional.acceptsFiles)
|
||||
.parse(argv);
|
||||
if(args.arg("path"))
|
||||
runFile(args.arg("path"));
|
||||
else
|
||||
runPrompt();
|
||||
return 0;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue