diff --git a/hank/Main.hx b/hank/Main.hx new file mode 100644 index 0000000..8388228 --- /dev/null +++ b/hank/Main.hx @@ -0,0 +1,28 @@ +package hank; + +import sys.FileSystem; +import hank.Story; + +class Main { + static function main() { + var args = Sys.args(); + + for (arg in args) { + if (FileSystem.exists(arg) && !FileSystem.isDirectory(arg)) { + Sys.println(arg); + Story.FromFile(arg).run((text, cc) -> { + Sys.println(text); + cc(); + }, (choices, choose) -> { + for (idx in 0...choices.length) { + Sys.println('${idx+1}. ${choices[idx]}'); + } + var choiceIndex = Std.parseInt(Sys.stdin().readLine()) - 1; + choose(choiceIndex); + }, () -> { + Sys.println("THE END"); + }); + } + } + } +} \ No newline at end of file diff --git a/haxelib.json b/haxelib.json index 10f9867..a8211d6 100644 --- a/haxelib.json +++ b/haxelib.json @@ -7,6 +7,7 @@ "version": "0.0.8", "releasenote": "It isn't safe to use this library yet.", "contributors": ["NQNStudios"], + "main": "hank.Main", "dependencies": { "hscript": "", "utest": ""