aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/program/compositor/cli.lux
blob: 8df1cc83975bf6916351cce6258ee217a756151a (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
40
41
42
43
(.module:
  [lux #*
   [control
    ["p" parser]
    ["." cli (#+ CLI)]]
   [world
    [file (#+ Path)]]]
  ## [///
  ##  [importer (#+ Source)]]
  )

(type: #export Configuration
  {## #sources (List Source)
   #sources (List Path)
   #target Path
   #module Text})

(type: #export Service
  (#Compilation Configuration)
  (#Interpretation Configuration))

(template [<name> <long>]
  [(def: #export <name>
     (CLI Text)
     (cli.named <long> cli.any))]

  [source "--source"]
  [target "--target"]
  [module "--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)))