aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/program/compositor/cli.lux
blob: 0c20257ed0b1b410f824a48f6a5552e7e900049e (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
(.module:
  [lux #*
   [control
    ["p" parser
     ["." cli (#+ Parser)]]]
   [world
    [file (#+ Path)]]])

(type: #export Service
  #Compilation
  #Interpretation)

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

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

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


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

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