aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/program/aedifex/command/pom.lux
blob: fed4f8771f347c9f19accca518de3be0d4ccea2a (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
(.module:
  [library
   [lux "*"
    [abstract
     [monad {"+" [do]}]]
    [control
     ["." try ("#\." functor)]
     [concurrency
      ["." async {"+" [Async]} ("#\." monad)]]]
    [data
     [text
      ["%" format {"+" [format]}]
      [encoding
       ["." utf8]]]
     [format
      ["." xml]]]
    [world
     ["." file]
     ["." console {"+" [Console]}]]]]
  ["." /// "_"
   [command {"+" [Command]}]
   ["#." action]
   ["#." pom]])

(def: .public success
  (format "Successfully created POM file: " ///pom.file))

(def: .public (do! console fs profile)
  (-> (Console Async) (file.System Async) (Command Any))
  (do ///action.monad
    [content (|> (///pom.write profile)
                 (try\each (|>> (\ xml.codec encoded)
                                (\ utf8.codec encoded)))
                 async\in)
     _ (\ fs write content ///pom.file)]
    (console.write_line ..success console)))