diff --git a/source/tlang/app.d b/source/tlang/app.d index 2a81899..1d6059d 100644 --- a/source/tlang/app.d +++ b/source/tlang/app.d @@ -9,8 +9,13 @@ module tlang; import std.stdio; +import commandline.args; -void main() +void main(string[] args) { - + /* TODO: Replace with something else */ + writeln("tlang NO_PUBLISH_RELEASE"); + + /* Parse the command-line arguments */ + parseCommandLine(args); } diff --git a/source/tlang/commandline/args.d b/source/tlang/commandline/args.d index 391c049..a2fa970 100644 --- a/source/tlang/commandline/args.d +++ b/source/tlang/commandline/args.d @@ -2,7 +2,11 @@ module commandline.args; import jcli; -void parseCommandLine(string[] args) +void parseCommandLine(string[] arguments) { - /* TODO: Parse command-line options here */ + /* Create an instance of the JCLI command-line parser */ + CommandLineInterface!(commandline.commands) commandLineSystem = new CommandLineInterface!(commandline.commands)(); + + /* Parse the command-line arguments */ + commandLineSystem.parseAndExecute(arguments); } \ No newline at end of file diff --git a/source/tlang/commandline/commands.d b/source/tlang/commandline/commands.d new file mode 100644 index 0000000..acbbdcb --- /dev/null +++ b/source/tlang/commandline/commands.d @@ -0,0 +1,35 @@ +/** +* Commands +* +* All command-line arguments and their impementations +*/ + +module commandline.commands; + +import jcli; +import std.stdio; + +@Command("help", "Shows the help screen") +struct helpCommand +{ + void onExecute() + { + + } +} + +@Command("compile", "Compiles the given file(s)") +struct compileCommand +{ + @CommandPositionalArg(0, "source file", "The source file to compile") + string sourceFile; + + // @CommandRawListArg + // string[] d; + // TODO: Get array + + void onExecute() + { + writeln("Compiling source file: "~sourceFile); + } +} \ No newline at end of file