aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/lux/platform/compiler/cli.lux
blob: 55ce35145e06cb836ed7a17384b1505c7c42c4d3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
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)))