From 0fe039a41571328a29b7a620643fc5e30e32b9a3 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Sat, 11 Aug 2018 10:59:38 -0400 Subject: Moved CLI machinery to stdlib. --- new-luxc/source/program.lux | 52 ++++++--------------------------------------- 1 file changed, 6 insertions(+), 46 deletions(-) (limited to 'new-luxc') diff --git a/new-luxc/source/program.lux b/new-luxc/source/program.lux index 7cb10b457..4e0925717 100644 --- a/new-luxc/source/program.lux +++ b/new-luxc/source/program.lux @@ -13,11 +13,12 @@ ["." io (#+ IO Process io)] [time ["." instant]] - ["." cli (#+ CLI program:)] + [cli (#+ program:)] [world ["." file (#+ File)]] [compiler - ["." default (#+ Configuration Platform)]]] + ["." cli] + ["." default (#+ Platform)]]] [luxc ## ["." repl] [lang @@ -27,47 +28,6 @@ ["." runtime] ["." expression]]]]]) -(type: Build - [Configuration Text]) - -(type: REPL - Configuration) - -(do-template [ ] - [(def: - (CLI Text) - (cli.parameter [ ]))] - - [source "-s" "--source"] - [target "-t" "--target"] - [program "-p" "--program"] - ) - -(def: configuration - (CLI Configuration) - ($_ p.and - (p.some ..source) - ..target)) - -(def: build - (CLI Build) - ($_ p.and - configuration - ..program)) - -(def: repl - (CLI REPL) - ..configuration) - -(type: Service - (#Build Build) - (#REPL REPL)) - -(def: service - (CLI Service) - (p.or (p.after (cli.this "build") build) - (p.after (cli.this "repl") repl))) - (def: (or-crash! failure-describer action) (All [a] (-> Text (Task a) (Promise a))) @@ -103,18 +63,18 @@ #default.runtime runtime.translate #default.file-system file.JVM@System}))) -(program: [{service ..service}] +(program: [{service cli.service}] (do io.Monad [platform ..jvm-platform] (wrap (: (Promise Any) (case service - (#Build [configuration program]) + (#cli.Build [configuration program]) (<| (or-crash! "Compilation failed:") promise.future ..timed (default.compile platform configuration program)) - (#REPL configuration) + (#cli.REPL configuration) (undefined) ## (<| (or-crash! "REPL failed:") ## (repl.run sources target)) -- cgit v1.2.3