aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/lux/platform/compiler/cli.lux
diff options
context:
space:
mode:
Diffstat (limited to 'stdlib/source/lux/platform/compiler/cli.lux')
-rw-r--r--stdlib/source/lux/platform/compiler/cli.lux39
1 files changed, 39 insertions, 0 deletions
diff --git a/stdlib/source/lux/platform/compiler/cli.lux b/stdlib/source/lux/platform/compiler/cli.lux
new file mode 100644
index 000000000..55ce35145
--- /dev/null
+++ b/stdlib/source/lux/platform/compiler/cli.lux
@@ -0,0 +1,39 @@
+(.module:
+ [lux #*
+ [control
+ ["p" parser]]
+ ["." cli (#+ CLI)]
+ [world
+ [file (#+ File)]]])
+
+(type: #export Configuration
+ {#sources (List File)
+ #target File
+ #module Text})
+
+(type: #export Service
+ (#Compilation Configuration)
+ (#Interpretation Configuration))
+
+(do-template [<name> <short> <long>]
+ [(def: #export <name>
+ (CLI Text)
+ (cli.parameter [<short> <long>]))]
+
+ [source "-s" "--source"]
+ [target "-t" "--target"]
+ [module "-m" "--module"]
+ )
+
+(def: #export configuration
+ (CLI Configuration)
+ ($_ p.and
+ (p.some ..source)
+ ..target
+ ..module))
+
+(def: #export service
+ (CLI Service)
+ ($_ p.or
+ (p.after (cli.this "build") ..configuration)
+ (p.after (cli.this "repl") ..configuration)))