aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/program/compositor/cli.lux
blob: 4453d5d36e2a9019f7c382c5e41761699b703202 (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 (#+ Parser)]]]
   [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>
     (Parser Text)
     (cli.named <long> cli.any))]

  [source "--source"]
  [target "--target"]
  [module "--module"]
  )

(def: #export configuration
  (Parser Configuration)
  ($_ p.and
      (p.some ..source)
      ..target
      ..module))

(def: #export service
  (Parser Service)
  ($_ p.or
      (p.after (cli.this "build") ..configuration)
      (p.after (cli.this "repl") ..configuration)))