use commandr
This commit is contained in:
parent
658f8f96c1
commit
074fde11ea
3 changed files with 9 additions and 6 deletions
1
dub.sdl
1
dub.sdl
|
|
@ -3,4 +3,5 @@ description "A minimal D application."
|
||||||
authors "tanya"
|
authors "tanya"
|
||||||
copyright "Copyright © 2025, tanya"
|
copyright "Copyright © 2025, tanya"
|
||||||
license "MPL-2.0"
|
license "MPL-2.0"
|
||||||
|
dependency "commandr" version="~>1.1.0"
|
||||||
dependency "taggedalgebraic" version="~>0.11.23"
|
dependency "taggedalgebraic" version="~>0.11.23"
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
{
|
{
|
||||||
"fileVersion": 1,
|
"fileVersion": 1,
|
||||||
"versions": {
|
"versions": {
|
||||||
|
"commandr": "1.1.0",
|
||||||
"taggedalgebraic": "0.11.23"
|
"taggedalgebraic": "0.11.23"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
13
src/main.d
13
src/main.d
|
|
@ -3,6 +3,8 @@ import std.file;
|
||||||
import std.conv;
|
import std.conv;
|
||||||
import std.exception;
|
import std.exception;
|
||||||
|
|
||||||
|
import commandr;
|
||||||
|
|
||||||
import token;
|
import token;
|
||||||
import tokentype;
|
import tokentype;
|
||||||
import scanner;
|
import scanner;
|
||||||
|
|
@ -44,12 +46,11 @@ void runPrompt(){
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(string[] argv){
|
int main(string[] argv){
|
||||||
if(argv.length > 2){
|
auto args = new Program("lox")
|
||||||
writeln("Usage: jlox [script]");
|
.add(new Argument("path").optional.acceptsFiles)
|
||||||
return 1;
|
.parse(argv);
|
||||||
}
|
if(args.arg("path"))
|
||||||
if(argv.length == 2)
|
runFile(args.arg("path"));
|
||||||
runFile(argv[1]);
|
|
||||||
else
|
else
|
||||||
runPrompt();
|
runPrompt();
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue